Package com.tonic.vellum.widget
Class Checkbox
- java.lang.Object
-
- com.tonic.vellum.Section
-
- com.tonic.vellum.widget.SingleRowSection
-
- com.tonic.vellum.widget.Checkbox
-
public final class Checkbox extends SingleRowSection
A focusable on/off toggle, flipped by ENTER or SPACE and drawn reversed while focused.
-
-
Constructor Summary
Constructors Constructor Description Checkbox(java.lang.String label)Creates an unchecked checkbox with the given label.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Checkboxchecked(boolean checked)Sets the checked state.booleanisChecked()CheckboxonChange(java.util.function.Consumer<java.lang.Boolean> handler)Sets the handler invoked with the new state whenever the checkbox is toggled.
-
-
-
Method Detail
-
checked
public Checkbox checked(boolean checked)
Sets the checked state.- Parameters:
checked- the new state- Returns:
- this Checkbox for chaining
-
isChecked
public boolean isChecked()
- Returns:
- true if checked
-
onChange
public Checkbox onChange(java.util.function.Consumer<java.lang.Boolean> handler)
Sets the handler invoked with the new state whenever the checkbox is toggled.- Parameters:
handler- the change handler- Returns:
- this Checkbox for chaining
-
-