JAL-2388 checkbox in overview popup for applet
authorJim Procter <jprocter@issues.jalview.org>
Fri, 12 May 2017 13:56:21 +0000 (14:56 +0100)
committerJim Procter <jprocter@issues.jalview.org>
Fri, 12 May 2017 13:56:21 +0000 (14:56 +0100)
src/jalview/appletgui/OverviewPanel.java

index 8c2b54b..b933d30 100755 (executable)
@@ -27,15 +27,15 @@ import jalview.viewmodel.OverviewDimensionsHideHidden;
 import jalview.viewmodel.OverviewDimensionsShowHidden;
 
 import java.awt.BorderLayout;
+import java.awt.CheckboxMenuItem;
 import java.awt.Dimension;
-import java.awt.MenuItem;
 import java.awt.Panel;
 import java.awt.PopupMenu;
-import java.awt.event.ActionEvent;
-import java.awt.event.ActionListener;
 import java.awt.event.ComponentAdapter;
 import java.awt.event.ComponentEvent;
 import java.awt.event.InputEvent;
+import java.awt.event.ItemEvent;
+import java.awt.event.ItemListener;
 import java.awt.event.MouseEvent;
 import java.awt.event.MouseListener;
 import java.awt.event.MouseMotionListener;
@@ -208,19 +208,19 @@ public class OverviewPanel extends Panel implements Runnable,
   private void showPopupMenu(MouseEvent e)
   {
     PopupMenu popup = new PopupMenu();
-    ActionListener menuListener = new ActionListener()
+    ItemListener menuListener = new ItemListener()
     {
       @Override
-      public void actionPerformed(ActionEvent event)
+      public void itemStateChanged(ItemEvent e)
       {
-        // switch on/off the hidden columns view
         toggleHiddenColumns();
       }
     };
-    MenuItem item = new MenuItem(
+    CheckboxMenuItem item = new CheckboxMenuItem(
             MessageManager.getString("label.togglehidden"));
+    item.setState(showHidden);
     popup.add(item);
-    item.addActionListener(menuListener);
+    item.addItemListener(menuListener);
     this.add(popup);
     popup.show(this, e.getX(), e.getY());
   }