Class GUITogglePanel

java.lang.Object
com.blackrook.gui.GUIObject
com.blackrook.gui.object.GUITogglePanel
All Implemented Interfaces:
GUIToggleable, GUIValueField<Boolean>
Direct Known Subclasses:
GUICheckbox, GUIRadioButton

public abstract class GUITogglePanel extends GUIObject implements GUIToggleable
A checkbox object that holds a boolean switch.

This object is very much undecorated. You will have to apply colors and stuff to it. Listening to its state will be useful for setting its colors and look.

Author:
Matthew Tropiano
  • Field Details

    • PRESS_ACTION

      protected static final GUIAction PRESS_ACTION
      Press action.
    • RELEASE_ACTION

      protected static final GUIAction RELEASE_ACTION
      Release action.
  • Constructor Details

    • GUITogglePanel

      public GUITogglePanel()
      Creates a new toggle panel in the unset, false state.
    • GUITogglePanel

      public GUITogglePanel(boolean startState)
      Creates a new toggle panel.
      Parameters:
      startState - the starting state (true or false).
  • Method Details

    • isSet

      public boolean isSet()
      Description copied from interface: GUIToggleable
      Gets the state of this toggleable object.
      Specified by:
      isSet in interface GUIToggleable
      Returns:
      true if this is in the enabled state, false if not.
    • toggle

      public GUIToggleable toggle()
      Description copied from interface: GUIToggleable
      Changes the state of this toggleable object to the opposite state. If true, calling this sets it to false. If false, calling this sets it to true.
      Specified by:
      toggle in interface GUIToggleable
      Returns:
      itself, to chain calls.
    • setState

      public GUIToggleable setState(boolean state)
      Description copied from interface: GUIToggleable
      Changes the state of this toggleable object to the specified state. Must fire an GUIValueField.EVENT_VALUE_CHANGE if the state of this object changes.
      Specified by:
      setState in interface GUIToggleable
      Parameters:
      state - the new state.
      Returns:
      itself, to chain calls.
    • getValue

      public Boolean getValue()
      Specified by:
      getValue in interface GUIValueField<Boolean>
      Returns:
      this field's current value.
    • setValue

      public GUIToggleable setValue(Object value)
      Description copied from interface: GUIValueField
      Sets this field's value. This must accept any object, and attempt to set the correct value based on it. This object must fire an GUIValueField.EVENT_VALUE_CHANGE event if it changes from its current value.
      Specified by:
      setValue in interface GUIValueField<Boolean>
      Parameters:
      value - the value to set.
      Returns:
      itself, to chain calls.
    • isBeingClicked

      public boolean isBeingClicked()
      Returns:
      true if this object is in the middle of being clicked.