Text Field
What it does
- This is a basic text field that allows players to enter text into.
Builder Parameters
message
(Optional)- The narration message.
- Default: null
hintText
(Optional)- The text that will be displayed in gray when there are no input.
- Default: null
onChange
(Optional)- A callback that will be triggered when the input text changes.
- Default: null
validator
(Optional)- A predicate that will be called when new text is entered to validate input.
- Default: null
formatter
(Optional)- A BiFunction that is called when text is changed to format the text.
- Default: null
Space Behaviour
- Maximum
Example
public class TestTextField implements UIComponent {
@Override
public UIComponent build(Layout layout) {
return new Center(
new Sized(
Size.staticSize(200, 20),
new TextField.Builder()
.withHintText(new StringTextComponent("hint text"))
.withOnChange(Tau.LOGGER::info)
)
);
}
}