Skip to content

ToggleToolButton

Two-state toolbar button combining ToolButton styling with ToggleButton mechanics.

Overview

ToggleToolButton is a toolbar button that stays highlighted when toggled active (e.g. Bold, Italic, Magnet tools).

Toolbar Bold Toggle

ToggleToolButton boldBtn = new ToggleToolButton()
        .icon("icons/bold.png")
        .checked(false);
boldBtn.onCheckedChanged(e -> textEditor.setBold(e.newValue()));