Class CheckBox

All Implemented Interfaces:
TextComponent, Serializable

public class CheckBox extends AbstractTextComponent
An implementation of a check box -- an item that can be selected or deselected, and which displays its state to the user.
See Also:
  • Field Details

    • DEFAULT_CHECK_BOX_TEXT

      public static final String DEFAULT_CHECK_BOX_TEXT
      Default text for checkbox.
      See Also:
  • Constructor Details

    • CheckBox

      public CheckBox()
      Default constructor which initialize checkbox with "CheckBox" text.
    • CheckBox

      public CheckBox(float x, float y, float width, float height)
      Constructor with position and size parameters. Initialize checkbox with "CheckBox" text.
      Parameters:
      x - x position position in parent component.
      y - y position position in parent component.
      width - width of component.
      height - height of component.
    • CheckBox

      public CheckBox(org.joml.Vector2f position, org.joml.Vector2f size)
      Constructor with position and size parameters. Initialize checkbox with "CheckBox" text.
      Parameters:
      position - position position in parent component.
      size - size of component.
    • CheckBox

      public CheckBox(String text)
      Default constructor which initialize checkbox with specified text.
      Parameters:
      text - specified text for checkbox.
    • CheckBox

      public CheckBox(String text, float x, float y, float width, float height)
      Constructor with position and size parameters. Initialize checkbox with "CheckBox" text.
      Parameters:
      text - specified text for checkbox.
      x - x position position in parent component.
      y - y position position in parent component.
      width - width of component.
      height - height of component.
    • CheckBox

      public CheckBox(String text, org.joml.Vector2f position, org.joml.Vector2f size)
      Constructor with position and size parameters. Initialize checkbox with "CheckBox" text.
      Parameters:
      text - specified text for checkbox.
      position - position position in parent component.
      size - size of component.
  • Method Details

    • getIconUnchecked

      public Icon getIconUnchecked()
      Returns checkbox icon for non-selected state.
      Returns:
      checkbox icon for non-selected state.
    • setIconUnchecked

      public void setIconUnchecked(Icon iconUnchecked)
      Used to set checkbox icon for non-selected state.
      Parameters:
      iconUnchecked - checkbox icon for non-selected state to set.
    • getIconChecked

      public Icon getIconChecked()
      Returns checkbox icon for selected state.
      Returns:
      checkbox icon for selected state.
    • setIconChecked

      public void setIconChecked(Icon iconChecked)
      Used to set checkbox icon for selected state.
      Parameters:
      iconChecked - checkbox icon for selected state to set.
    • isChecked

      public boolean isChecked()
      Returns true if checkbox is checked.
      Returns:
      true if checkbox is checked.
    • setChecked

      public void setChecked(boolean checked)
      Used to change checked state.
      Parameters:
      checked - new checkbox state.
    • addCheckBoxChangeValueListener

      public void addCheckBoxChangeValueListener(EventListener<CheckBoxChangeValueEvent> listener)
      Used to add checkbox change value event listener.
      Parameters:
      listener - listener to add.
    • getCheckBoxChangeValueEventListeners

      public List<EventListener<CheckBoxChangeValueEvent>> getCheckBoxChangeValueEventListeners()
      Used to get all event listeners for checkbox change value event.
      Returns:
      all event listeners for checkbox change value event.
    • removeCheckBoxChangeValueListener

      public void removeCheckBoxChangeValueListener(EventListener<CheckBoxChangeValueEvent> listener)
      Used to remove event listener for checkbox change value event.
      Parameters:
      listener - listener to remove.
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Component
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Component
    • toString

      public String toString()
      Overrides:
      toString in class Component