Select all cutandpaste
authoramwaterhouse <Andrew Waterhouse>
Fri, 7 Oct 2005 10:22:57 +0000 (10:22 +0000)
committeramwaterhouse <Andrew Waterhouse>
Fri, 7 Oct 2005 10:22:57 +0000 (10:22 +0000)
src/jalview/gui/CutAndPasteTransfer.java
src/jalview/jbgui/GCutAndPasteTransfer.java

index db6fb18..a10f433 100755 (executable)
@@ -39,19 +39,25 @@ import javax.swing.*;
  */\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
@@ -81,8 +87,9 @@ public class CutAndPasteTransfer extends GCutAndPasteTransfer
      */\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
index 384f09e..a917ebe 100755 (executable)
@@ -47,8 +47,9 @@ public class GCutAndPasteTransfer extends JInternalFrame
     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
@@ -104,7 +105,15 @@ public class GCutAndPasteTransfer extends JInternalFrame
                     }\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
@@ -133,7 +142,8 @@ public class GCutAndPasteTransfer extends JInternalFrame
         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
@@ -197,4 +207,9 @@ public class GCutAndPasteTransfer extends JInternalFrame
         throws PropertyVetoException\r
     {\r
     }\r
+\r
+    public void selectAll_actionPerformed(ActionEvent e)\r
+    {\r
+      textarea.selectAll();\r
+    }\r
 }\r