Component, Interactable, TextGUIElementpublic class CheckBox extends AbstractInteractableComponent<CheckBox>
| Modifier and Type | Class | Description |
|---|---|---|
static class |
CheckBox.CheckBoxRenderer |
Helper interface that doesn't add any new methods but makes coding new check box renderers a little bit more clear
|
static class |
CheckBox.DefaultCheckBoxRenderer |
The default renderer that is used unless overridden.
|
static interface |
CheckBox.Listener |
Listener interface that can be used to catch user events on the check box
|
Interactable.FocusChangeDirection, Interactable.Result| Constructor | Description |
|---|---|
CheckBox() |
Creates a new checkbox with no label, initially set to un-checked
|
CheckBox(String label) |
Creates a new checkbox with a specific label, initially set to un-checked
|
| Modifier and Type | Method | Description |
|---|---|---|
CheckBox |
addListener(CheckBox.Listener listener) |
Adds a listener to this check box so that it will be notificed on certain user actions
|
protected CheckBox.CheckBoxRenderer |
createDefaultRenderer() |
When you create a custom component, you need to implement this method and return a Renderer which is responsible
for taking care of sizing the component, rendering it and choosing where to place the cursor (if Interactable).
|
String |
getLabel() |
Returns the label of check box
|
Interactable.Result |
handleKeyStroke(KeyStroke keyStroke) |
This method can be overridden to handle various user input (mostly from the keyboard) when this component is in
focus.
|
boolean |
isChecked() |
Returns the checked state of this check box
|
CheckBox |
removeListener(CheckBox.Listener listener) |
Removes a listener from this check box so that, if it was previously added, it will no long receive any events
|
CheckBox |
setChecked(boolean checked) |
Programmatically updated the check box to a particular checked state
|
CheckBox |
setLabel(String label) |
Updates the label of the checkbox
|
addTo, calculatePreferredSize, draw, getBasePane, getLayoutData, getParent, getPosition, getPreferredSize, getSize, getTextGUI, getTheme, getThemeDefinition, hasParent, invalidate, isInside, isInvalid, onAdded, onAfterDrawing, onBeforeDrawing, onRemoved, runOnGUIThreadIfExistsOtherwiseRunDirect, self, setLayoutData, setPosition, setPreferredSize, setRenderer, setSize, setTheme, toBasePane, toGlobal, withBorderafterEnterFocus, afterLeaveFocus, getCursorLocation, getInputFilter, getRenderer, handleInput, isEnabled, isFocusable, isFocused, onEnterFocus, onLeaveFocus, setEnabled, setInputFilter, takeFocusaddTo, getBasePane, getLayoutData, getParent, getPosition, getPreferredSize, getSize, getTextGUI, getTheme, getThemeDefinition, hasParent, invalidate, isInside, onAdded, onRemoved, setLayoutData, setPosition, setPreferredSize, setSize, setTheme, toBasePane, toGlobal, withBorderclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitdraw, isInvalidpublic CheckBox()
public CheckBox(String label)
label - Label to assign to the check boxpublic CheckBox setChecked(boolean checked)
checked - If true, the check box will be set to toggled on, otherwise falsepublic boolean isChecked()
true if the check box is toggled on, otherwise falsepublic Interactable.Result handleKeyStroke(KeyStroke keyStroke)
AbstractInteractableComponenthandleInput(..) is final in
AbstractInteractableComponent to ensure the input filter is properly handled. If the filter decides that
this event should be processed, it will call this method.handleKeyStroke in class AbstractInteractableComponent<CheckBox>keyStroke - What input was entered by the userpublic CheckBox setLabel(String label)
label - New label to assign to the check boxpublic String getLabel()
public CheckBox addListener(CheckBox.Listener listener)
listener - Listener to fire events onpublic CheckBox removeListener(CheckBox.Listener listener)
listener - Listener to remove from the check boxprotected CheckBox.CheckBoxRenderer createDefaultRenderer()
AbstractComponentcreateDefaultRenderer in class AbstractInteractableComponent<CheckBox>Copyright © 2020. All rights reserved.