Record Class EditorButton
java.lang.Object
java.lang.Record
dev.boze.api.gui.editor.EditorButton
- Record Components:
role- What kind of action it is; themes may style roles differentlyenabled- Whether it can be pressed right now
public record EditorButton(String label, EditorButton.Role role, BooleanSupplier enabled, Runnable action)
extends Record
A button in an editor.
-
Nested Class Summary
Nested Classes -
Constructor Summary
ConstructorsConstructorDescriptionEditorButton(String label, EditorButton.Role role, Runnable action) A button that is always enabled.EditorButton(String label, EditorButton.Role role, BooleanSupplier enabled, Runnable action) Creates an instance of aEditorButtonrecord class.EditorButton(String label, Runnable action) A secondary button that is always enabled. -
Method Summary
Modifier and TypeMethodDescriptionaction()Returns the value of theactionrecord component.enabled()Returns the value of theenabledrecord component.final booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.booleanlabel()Returns the value of thelabelrecord component.voidpress()Runs the action if the button is enabled.role()Returns the value of therolerecord component.final StringtoString()Returns a string representation of this record class.
-
Constructor Details
-
EditorButton
Creates an instance of aEditorButtonrecord class. -
EditorButton
-
EditorButton
A button that is always enabled.
-
-
Method Details
-
isEnabled
public boolean isEnabled() -
press
public void press()Runs the action if the button is enabled. -
toString
-
hashCode
-
equals
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. All components in this record class are compared withObjects::equals(Object,Object). -
label
Returns the value of thelabelrecord component.- Returns:
- the value of the
labelrecord component
-
role
-
enabled
-
action
Returns the value of theactionrecord component.- Returns:
- the value of the
actionrecord component
-