ui/src/main/java/ucar/nc2/ui/widget/BAMutil.java
public static void setActionProperties( AbstractAction act, String icon_name, String action_name,
    boolean is_toggle, int mnemonic, int accel ) {
    if (icon_name != null) {
      act.putValue( Action.SMALL_ICON, getIcon( icon_name, true));
      act.putValue( BAMutil.SELECTED_ICON, getIcon( icon_name + "Sel", false));
    }
    act.putValue( Action.SHORT_DESCRIPTION, action_name);
    act.putValue( Action.LONG_DESCRIPTION, action_name);
    act.putValue( BAMutil.TOGGLE, new Boolean(is_toggle));
    act.putValue( BAMutil.MNEMONIC, new Integer(mnemonic));
    act.putValue( BAMutil.ACCEL, new Integer(accel));
  }
public static void setActionProperties( AbstractAction act, String icon_name, String action_name,
    boolean is_toggle, int mnemonic, int accel ) {
    if (icon_name != null) {
      act.putValue( Action.SMALL_ICON, getIcon( icon_name, true));
      act.putValue( BAMutil.SELECTED_ICON, getIcon( icon_name + "Sel", false));
    }
    act.putValue( Action.SHORT_DESCRIPTION, action_name);
    act.putValue( Action.LONG_DESCRIPTION, action_name);
    act.putValue( BAMutil.TOGGLE, new Boolean(is_toggle));
    act.putValue( BAMutil.MNEMONIC, new Integer(mnemonic));
    act.putValue( BAMutil.ACCEL, new Integer(accel));
  }
Standard way to set Properties for Actions.
This also looks for an Icon "<icon_name>Sel" and if it exists:
1) sets SelectedIcon if its a toggle, or
2) sets the Icon when selected (optional) if its not a toggle

If is_toggle, a toggle button is created (in addActionToContainer()), default state false
To get or set the state of the toggle button:
Boolean state = (Boolean) action.getValue(BAMutil.STATE);
action.putValue(BAMutil.STATE, new Boolean(true/false));

@param act  add properties to this action
@param icon_name name of icon (or null).
@param action_name menu name / tooltip
@param is_toggle true if its a toggle
@param mnemonic  menu item shortcut
@param accel menu item global keyboard accelerator