Class GeneiousAction.ToggleAction

  • All Implemented Interfaces:
    java.awt.event.ActionListener, java.io.Serializable, java.lang.Cloneable, java.util.EventListener, javax.swing.Action
    Enclosing class:
    GeneiousAction

    public abstract static class GeneiousAction.ToggleAction
    extends GeneiousAction
    A subclass of GeneiousAction which is placed in a toolbar/menu as a toggle button or check box menu item.
    See Also:
    Serialized Form
    • Field Detail

      • TOGGLED_PROPERTY_NAME

        public static final java.lang.String TOGGLED_PROPERTY_NAME
        The name of the property for which a propertyChange event is fired when the action is toggled
        See Also:
        Constant Field Values
    • Constructor Detail

      • ToggleAction

        protected ToggleAction​(GeneiousActionOptions actionOptions)
        Construct a Toggle action with its properties specified by the GeneiousActionOptions
        Parameters:
        actionOptions - GeneiousActionOptions specifying the properties of this action.
      • ToggleAction

        public ToggleAction​(GeneiousAction.ToggleAction internalAction)
        Creates a ToggleAction that wraps another toggle action. This action's implementation of actionToggled must include the following two lines:
         internalAction.setSelected(isSelected);
         internalAction.actionToggled(e, isSelected);
         
        Parameters:
        internalAction - the internal ToggleAction that all methods are delegated to.
    • Method Detail

      • isSelected

        public boolean isSelected()
        Whether or not this action is selected
        Returns:
        true if the action is selected (checked if a check-box menu item, toggled on if a button), false otherwise
      • setSelected

        public void setSelected​(boolean isSelected)
        Set the selected state of the action
        Parameters:
        isSelected - true to have the action selected (checked if a check-box menu item, toggled on if a button), false otherwise.
      • actionPerformed

        public final void actionPerformed​(java.awt.event.ActionEvent e)
      • actionToggled

        public abstract void actionToggled​(java.awt.event.ActionEvent e,
                                           boolean isSelected)
        Called when the action is performed, indicating that the selected state of the action has changed.
        Parameters:
        e - ActionEvent fired by the component
        isSelected - the new selection state of the action