ButtonBase

abstract class ButtonBase(text: String, graphic: Node? = null) : Labelled, Actionable, HasDisabled

The base class for Button, ToggleButton, RadioButton ...

Theme DSL

( "button" or "toggle_button" or "radio_button" or "check_box" ) {

    ":armed" { ... }

    ":focus" { ... }

    ":hover" { ... }
}

ButtonBase inherits all the features of Labelled.

Note, Glok's default theme also uses the style .tinted to indicate that the button's graphic should be tinted with the theme's font color. When the button is disabled, the tinted color is semi-transparent, to make it look disabled. See ImageView.tint.

Class Diagram

                                            ╭╌╌╌╌╌╌╌╌╌╌╌╌╌╮
                                            ┆ Labelled    ┆
                                            ┆   text      ┆
                                            ┆   graphic   ┆
                                            ╰╌╌╌╌╌╌╌╌╌╌╌╌╌╯
                                                   △
                                            ╭╌╌╌╌╌╌┴╌╌╌╌╌╌╮                                                ╭╌╌╌╌╌╌╌╌╌╌╌╌╌╌╮
                                            ┆ ButtonBase  ┆                      ┏━━━━━━━━━━━━━━━━┓        ┆ /Toggle/     ┆
                                            ┆   disabled  ┆                      ┃ToggleGroup     ┃        ┆   selected   ┆
                                            ┆   armed     ┆                      ┃  selectedToggle┃◇───────┤   toggleGroup┆
                                            ┆   onAction  ┆                      ┃  userData()    ┃        ┆   userData   ┆
                                            ╰╌╌╌╌╌╌╌╌╌╌╌╌╌╯                      ┗━━━━━━━━━━━━━━━━┛        ╰╌╌╌╌╌╌╌╌╌╌╌╌╌╌╯
                                                   △                                                              △
          ┌─────────────────┬─────────────────┬────┴───────────────┬──────────────────┬───────────────┐           │
┏━━━━━━━━━┷━━━━━━━┓   ┏━━━━━┷━━━━━┓   ┏━━━━━━━┷━━━━━━━┓   ┏━━━━━━━━┷━━━━━━━━┓    ┏━━━━┷━━━━┓  ╭╌╌╌╌╌╌╌┴╌╌╌╌╌╌╌╌╮  │
┃Button           ┃   ┃MenuButton ┃   ┃SplitMenuButton┃   ┃ColorButton      ┃    ┃Menu     ┃  ┆SelectButtonBase┆  │
┃   defaultButton ┃   ┃  items    ┃   ┃  items        ┃   ┃  color          ┃    ┃  items  ┃  ┆  selected      ┆  │
┃   cancelButton  ┃   ┃           ┃   ┃               ┃   ┃   ...           ┃    ┃         ┃  ┆                ┆  │
┗━━━━━━━━━━━━━━━━━┛   ┗━━━━━━━━━━━┛   ┗━━━━━━━━━━━━━━━┛   ┗━━━━━━━━━━━━━━━━━┛    ┗━━━━━━━━━┛  ╰╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╯  │
                                                                             (within a MenuBar)   △               │
                                                                                                  │               │
                        ┌───────────────────────┬───────────────────────────┬─────────────────────┴──┐  ┌─────────┴───────┐
              ┏━━━━━━━━━┷━━━━━━━━━┓   ┏━━━━━━━━━┷━━━━━━━━━┓   ┏━━━━━━━━━━━━━┷━━━━━━┓       ╭╌╌╌╌╌╌╌╌╌┴╌╌┴╌╌╌╮             ╵
              ┃Checkbox           ┃   ┃PropertyRadioButton┃   ┃PropertyToggleButton┃       ┆ToggleButtonBase┆    ToggleMenuItemBase
              ┃ intermediate      ┃   ┃  property         ┃   ┃  property          ┃       ┆                ┆
              ┃ allowIndeterminate┃   ┃  value            ┃   ┃  value             ┃       ┆                ┆
              ┗━━━━━━━━━━━━━━━━━━━┛   ┗━━━━━━━━━━━━━━━━━━━┛   ┗━━━━━━━━━━━━━━━━━━━━┛       ╰╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╯
            (No menu-item equivalent)                                                              △
                                                                                                   │
                                                                                           ┌───────┴────────┐
                                                                                   ┏━━━━━━━┷━━━━┓   ┏━━━━━━━┷━━━┓
                                                                                   ┃ToggleButton┃   ┃RadioButton┃
                                                                                   ┃            ┃   ┃           ┃
                                                                                   ┗━━━━━━━━━━━━┛   ┗━━━━━━━━━━━┛

Created with Blokart.

Inheritors

Constructors

Link copied to clipboard
constructor(text: String, graphic: Node? = null)

Types

Link copied to clipboard

Keyboard combinations :

Properties

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
override var disabled: Boolean
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard

An event handler for when this button is pressed.

Functions

Link copied to clipboard
fun onAction(handlerCombination: HandlerCombination = HandlerCombination.AFTER, block: (event: ActionEvent) -> Unit)

Usage :

Link copied to clipboard
open override fun performAction()