Record Class WidgetState

java.lang.Object
java.lang.Record
dev.boze.api.gui.kit.WidgetState
Record Components:
key - Identity of the piece that stays the same from frame to frame, for animating it (for example with Spring), or null
hovered - The mouse is over it
pressed - It is hovered while the left mouse button is held
focused - It takes typing, or is being edited
selected - It is the current choice, such as the open tab or the chosen row
disabled - It cannot be used right now

public record WidgetState(Object key, boolean hovered, boolean pressed, boolean focused, boolean selected, boolean disabled) extends Record
How a piece of a built-in layout is being used this frame.
  • Field Details

    • IDLE

      public static final WidgetState IDLE
      A piece nothing is happening to.
  • Constructor Details

    • WidgetState

      public WidgetState(Object key, boolean hovered, boolean pressed, boolean focused, boolean selected, boolean disabled)
      Creates an instance of a WidgetState record class.
      Parameters:
      key - the value for the key record component
      hovered - the value for the hovered record component
      pressed - the value for the pressed record component
      focused - the value for the focused record component
      selected - the value for the selected record component
      disabled - the value for the disabled record component
  • Method Details

    • withFocused

      public WidgetState withFocused(boolean focused)
    • withSelected

      public WidgetState withSelected(boolean selected)
    • withDisabled

      public WidgetState withDisabled(boolean disabled)
    • toString

      public final String toString()
      Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • hashCode

      public final int hashCode()
      Returns a hash code value for this object. The value is derived from the hash code of each of the record components.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. Reference components are compared with Objects::equals(Object,Object); primitive components are compared with the compare method from their corresponding wrapper classes.
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • key

      public Object key()
      Returns the value of the key record component.
      Returns:
      the value of the key record component
    • hovered

      public boolean hovered()
      Returns the value of the hovered record component.
      Returns:
      the value of the hovered record component
    • pressed

      public boolean pressed()
      Returns the value of the pressed record component.
      Returns:
      the value of the pressed record component
    • focused

      public boolean focused()
      Returns the value of the focused record component.
      Returns:
      the value of the focused record component
    • selected

      public boolean selected()
      Returns the value of the selected record component.
      Returns:
      the value of the selected record component
    • disabled

      public boolean disabled()
      Returns the value of the disabled record component.
      Returns:
      the value of the disabled record component