Package jexer

Class TCheckBox

  • All Implemented Interfaces:
    java.lang.Comparable<TWidget>

    public class TCheckBox
    extends TWidget
    TCheckBox implements an on/off checkbox.
    • Constructor Detail

      • TCheckBox

        public TCheckBox​(TWidget parent,
                         int x,
                         int y,
                         java.lang.String label,
                         boolean checked)
        Public constructor.
        Parameters:
        parent - parent widget
        x - column relative to parent
        y - row relative to parent
        label - label to display next to (right of) the checkbox
        checked - initial check state
      • TCheckBox

        public TCheckBox​(TWidget parent,
                         int x,
                         int y,
                         java.lang.String label,
                         boolean checked,
                         TAction action)
        Public constructor.
        Parameters:
        parent - parent widget
        x - column relative to parent
        y - row relative to parent
        label - label to display next to (right of) the checkbox
        checked - initial check state
        action - the action to perform when the checkbox is toggled
    • Method Detail

      • onMouseDown

        public void onMouseDown​(TMouseEvent mouse)
        Handle mouse checkbox presses.
        Overrides:
        onMouseDown in class TWidget
        Parameters:
        mouse - mouse button down event
      • onKeypress

        public void onKeypress​(TKeypressEvent keypress)
        Handle keystrokes.
        Overrides:
        onKeypress in class TWidget
        Parameters:
        keypress - keystroke event
      • draw

        public void draw()
        Draw a checkbox with label.
        Overrides:
        draw in class TWidget
      • isChecked

        public boolean isChecked()
        Get checked value.
        Returns:
        if true, this is checked
      • setChecked

        public void setChecked​(boolean checked)
        Set checked value.
        Parameters:
        checked - new checked value.
      • getMnemonic

        public MnemonicString getMnemonic()
        Get the mnemonic string for this checkbox.
        Returns:
        mnemonic string
      • dispatch

        public void dispatch()
        Act as though the checkbox was pressed. This is useful for other UI elements to get the same action as if the user clicked the checkbox.