Invert selection
authoramwaterhouse <Andrew Waterhouse>
Thu, 11 May 2006 13:54:10 +0000 (13:54 +0000)
committeramwaterhouse <Andrew Waterhouse>
Thu, 11 May 2006 13:54:10 +0000 (13:54 +0000)
src/jalview/gui/FeatureSettings.java

index 23f22a3..5565292 100755 (executable)
@@ -69,11 +69,20 @@ public class FeatureSettings extends JPanel
     JPanel transPanel = new JPanel(new FlowLayout());\r
     transPanel.add(new JLabel("Transparency"));\r
     transPanel.add(transparency);\r
+    JButton button = new JButton("Invert Selection");\r
+    transPanel.add(button);\r
+    button.addActionListener(new ActionListener()\r
+        {\r
+          public void actionPerformed(ActionEvent evt)\r
+          {\r
+            invertSelection();\r
+          }\r
+        });\r
 \r
     //////////////////////////////////////////////\r
     //We're going to need those OK cancel buttons\r
     JPanel buttonPanel = new JPanel(new FlowLayout());\r
-    JButton button = new JButton("OK");\r
+    button = new JButton("OK");\r
     button.addActionListener(new ActionListener()\r
     {\r
       public void actionPerformed(ActionEvent evt)\r
@@ -437,6 +446,18 @@ public class FeatureSettings extends JPanel
             ex.printStackTrace();\r
         }\r
     }\r
+  }\r
+\r
+  public void invertSelection()\r
+  {\r
+    for(int i=0; i<table.getRowCount(); i++)\r
+    {\r
+      Boolean value = (Boolean)table.getValueAt(i,2);\r
+\r
+      table.setValueAt(\r
+          new Boolean(!value.booleanValue()),\r
+                       i,2);\r
+    }\r
 \r
   }\r
 \r