Button
The ButtonComponent
class makes it possible to add your own labeled elements to the user interface and equip them with an action event. The button is selectable and can be controlled by tab, arrow keys or mouse input.
ButtonComponent buttonComponent = new ButtonComponent();
buttonComponent.text("I am Button");
buttonComponent.action(() -> {
//...
});


Methods
Method | Description |
---|---|
| Returns the recommended width |
| Returns the name |
| Sets the name and adjust the size |
| Returns the action event |
| Sets the action event |
Events
ButtonClickedEvent
Event is sent on interaction with button.
buttonComponent.eventBus().subscribe(ButtonClickedEvent.class, event -> {
//...
});
Last modified: 01 Juni 2025