Class CutCopyPasteTest

java.lang.Object
  extended byCutCopyPasteTest

public class CutCopyPasteTest
extends java.lang.Object

Class CutCopyPasteTest illustrates basic cut, copy, and paste operations between two text fields. The cut, copy, and paste commands are on a pulldown menu. The cut and copy commands take text from the left text field. The paste command pastes the cut or copied text into the right text field.


Field Summary
protected static javax.swing.JTextField field1
          Field 1, from which text is cut and copied
protected static javax.swing.JTextField field2
          Field 2, into which text is pasted
protected static javax.swing.JMenu menu
          The Edit menu with Cut, Copy, and Paste items
protected static javax.swing.JMenuBar menubar
          The menu bar with the Edit menu
protected static javax.swing.Box textFields
          The two text fields box
 
Constructor Summary
CutCopyPasteTest()
           
 
Method Summary
protected static void composeMenu()
          Compose the menubar, menu, and items.
protected static void composeTextFields()
          Compose the text fields.
static void copy()
          Copy text from field1 to system clipboard.
static void cut()
          Cut text from field1 to system clipboard.
static void main(java.lang.String[] args)
          Create menubar, text fields and buttons and display in a JFrame; see code body comments for details.
static void paste()
          Past cut or copied text from system clipboard to field2.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

menubar

protected static javax.swing.JMenuBar menubar
The menu bar with the Edit menu


menu

protected static javax.swing.JMenu menu
The Edit menu with Cut, Copy, and Paste items


field1

protected static javax.swing.JTextField field1
Field 1, from which text is cut and copied


field2

protected static javax.swing.JTextField field2
Field 2, into which text is pasted


textFields

protected static javax.swing.Box textFields
The two text fields box

Constructor Detail

CutCopyPasteTest

public CutCopyPasteTest()
Method Detail

main

public static void main(java.lang.String[] args)
Create menubar, text fields and buttons and display in a JFrame; see code body comments for details.


composeMenu

protected static void composeMenu()
Compose the menubar, menu, and items.


composeTextFields

protected static void composeTextFields()
Compose the text fields.


cut

public static void cut()
Cut text from field1 to system clipboard.


copy

public static void copy()
Copy text from field1 to system clipboard.


paste

public static void paste()
Past cut or copied text from system clipboard to field2.