*/\r
public class CutAndPasteTransfer extends GCutAndPasteTransfer\r
{\r
+\r
+ public CutAndPasteTransfer()\r
+ {\r
+ SwingUtilities.invokeLater(new Runnable()\r
+ {\r
+ public void run()\r
+ {\r
+ textarea.requestFocus();\r
+ }\r
+ });\r
+\r
+ }\r
+\r
/**\r
* DOCUMENT ME!\r
*/\r
public void setForInput()\r
{\r
getContentPane().add(inputButtonPanel, java.awt.BorderLayout.SOUTH);\r
- SwingUtilities.invokeLater(new Runnable()\r
- {\r
- public void run()\r
- {\r
- textarea.requestFocus();\r
- }\r
- });\r
}\r
\r
/**\r
*/\r
public void copyItem_actionPerformed(ActionEvent e)\r
{\r
+ textarea.getSelectedText();\r
Clipboard c = Toolkit.getDefaultToolkit().getSystemClipboard();\r
- c.setContents(new StringSelection(textarea.getText()), null);\r
+ c.setContents(new StringSelection(textarea.getSelectedText()), null);\r
}\r
\r
/**\r
protected JPanel inputButtonPanel = new JPanel();\r
JButton ok = new JButton();\r
JButton cancel = new JButton();\r
+ JMenuItem selectAll = new JMenuItem();\r
\r
- /**\r
+ /**\r
* Creates a new GCutAndPasteTransfer object.\r
*/\r
public GCutAndPasteTransfer()\r
}\r
}\r
});\r
- editMenubar.add(editMenu);\r
+ selectAll.setText("Select All");\r
+ selectAll.addActionListener(new ActionListener()\r
+ {\r
+ public void actionPerformed(ActionEvent e)\r
+ {\r
+ selectAll_actionPerformed(e);\r
+ }\r
+ });\r
+ editMenubar.add(editMenu);\r
textarea.setFont(new java.awt.Font("Monospaced", Font.PLAIN, 12));\r
textarea.addMouseListener(new java.awt.event.MouseAdapter()\r
{\r
this.getContentPane().setLayout(borderLayout2);\r
scrollPane.setBorder(null);\r
scrollPane.getViewport().add(textarea, null);\r
- editMenu.add(copyItem);\r
+ editMenu.add(selectAll);\r
+ editMenu.add(copyItem);\r
editMenu.add(pasteMenu);\r
this.getContentPane().add(scrollPane, java.awt.BorderLayout.CENTER);\r
inputButtonPanel.add(ok);\r
throws PropertyVetoException\r
{\r
}\r
+\r
+ public void selectAll_actionPerformed(ActionEvent e)\r
+ {\r
+ textarea.selectAll();\r
+ }\r
}\r