ui/src/main/java/ucar/nc2/ui/widget/PopupMenu.java
public void addActionCheckBox( String menuName, AbstractAction act, boolean state) {
    JMenuItem mi = new JCheckBoxMenuItem(menuName, state);
    mi.addActionListener( new BAMutil.ActionToggle(act, mi));
    act.putValue(BAMutil.STATE, new Boolean(state));
    add( mi);
  }
public void addActionCheckBox( String menuName, AbstractAction act, boolean state) {
    JMenuItem mi = new JCheckBoxMenuItem(menuName, state);
    mi.addActionListener( new BAMutil.ActionToggle(act, mi));
    act.putValue(BAMutil.STATE, new Boolean(state));
    add( mi);
  }
public void addActionCheckBox ( String menuName , AbstractAction act , boolean state ) { JMenuItem mi = new JCheckBoxMenuItem ( menuName , state ) ; mi . addActionListener ( new BAMutil . ActionToggle ( act , mi ) ) ; act . putValue ( BAMutil . STATE , new Boolean ( state ) ) ; add ( mi ) ; }
Add an action to the popup menu, using a JCheckBoxMenuItem.
Fetch the toggle state using:
<pre>Boolean state = (Boolean) act.getValue(BAMutil.STATE); </pre>
@param menuName name of the action on the menu.
@param act the Action.
@param state : initial state of the checkbox
Add an action to the popup menu using a JCheckBoxMenuItem . Fetch the toggle state using : <pre > Boolean state = ( Boolean ) act . getValue ( BAMutil . STATE ) ; < / pre >