Class 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.
    • Constructor Detail

      • Checkbox

        public Checkbox​(java.lang.String label)
        Creates an unchecked checkbox with the given label.
        Parameters:
        label - the label text; treated as empty if null
    • 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