Module is.codion.swing.common.ui
Interface ToggleMenuItemBuilder<C extends JMenuItem,B extends ToggleMenuItemBuilder<C,B>>
- All Superinterfaces:
ButtonBuilder<C,,Boolean, B> ComponentBuilder<C,,B> ComponentValueBuilder<C,,Boolean, B> Supplier<C>
- All Known Subinterfaces:
CheckBoxMenuItemBuilder<B>,RadioButtonMenuItemBuilder<B>
public interface ToggleMenuItemBuilder<C extends JMenuItem,B extends ToggleMenuItemBuilder<C,B>>
extends ButtonBuilder<C,Boolean,B>
Builds a toggle menu item.
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic enumSpecifies whether a menu is kept open after a toggle menu item has been toggled. -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final PropertyValue<ToggleMenuItemBuilder.PersistMenu> Specifies whether a menu persists after a toggle menu item has been toggled Value type:ToggleMenuItemBuilder.PersistMenuDefault value:ToggleMenuItemBuilder.PersistMenu.ALWAYSFields inherited from interface is.codion.swing.common.ui.component.builder.ComponentValueBuilder
COMPONENT_VALUE -
Method Summary
Modifier and TypeMethodDescriptionaccelerator(@Nullable KeyStroke accelerator) Sets the accelerator displayed by the menu item, in place of any accelerator of its action.link(ObservableState linkedState) Creates a read-only link to the givenObservableState.Creates a bidirectional link to the given state.persistMenu(ToggleMenuItemBuilder.PersistMenu persistMenu) toggle(ToggleControl toggleControl) Links the value of the given toggle control to the menu item, the menu item toggling it, the control providing the caption, icon and enabled state.toggle(Supplier<ToggleControl> toggleControl) Methods inherited from interface is.codion.swing.common.ui.component.button.ButtonBuilder
action, actionListener, borderPainted, buttonGroup, contentAreaFilled, control, control, disabledIcon, disabledSelectedIcon, focusPainted, horizontalAlignment, horizontalTextPosition, icon, iconTextGap, includeText, margin, mnemonic, multiClickThreshold, pressedIcon, rolloverEnabled, rolloverIcon, rolloverSelectedIcon, selected, selectedIcon, text, verticalAlignment, verticalTextPositionMethods inherited from interface is.codion.swing.common.ui.component.builder.ComponentBuilder
ancestorListener, background, border, build, build, clientProperty, componentListener, componentOrientation, enabled, enabled, focusable, focusable, focusCycleRoot, focusListener, font, font, foreground, get, hierarchyListener, keyEvent, keyListener, label, label, label, maximumHeight, maximumSize, maximumWidth, minimumHeight, minimumSize, minimumWidth, mouseListener, mouseMotionListener, mouseWheelListener, name, onBuild, onSetVisible, opaque, popupControl, popupControls, popupControls, popupMenu, preferredHeight, preferredSize, preferredWidth, propertyChangeListener, propertyChangeListener, scrollPane, toolTipText, toolTipText, transferFocusOnEnter, transferFocusOnEnter, transferHandler, visible, visibleMethods inherited from interface is.codion.swing.common.ui.component.builder.ComponentValueBuilder
buildValue, buildValue, changeConsumer, changeListener, consumer, link, link, listener, modified, modifiedIndicator, onBuildValue, valid, valid, validationIndicator, validator, value, warned, weakChangeConsumer, weakChangeListener, weakConsumer, weakListener, when, when, when, when
-
Field Details
-
PERSIST_MENU
Specifies whether a menu persists after a toggle menu item has been toggled- Value type:
ToggleMenuItemBuilder.PersistMenu - Default value:
ToggleMenuItemBuilder.PersistMenu.ALWAYS
- Value type:
-
-
Method Details
-
toggle
Links the value of the given toggle control to the menu item, the menu item toggling it, the control providing the caption, icon and enabled state.- Parameters:
toggleControl- the toggle control to base this toggle menu item on- Returns:
- this builder instance
- Throws:
IllegalArgumentException- in case the value is nullable
-
toggle
- Parameters:
toggleControl- the toggle control to base this toggle menu on- Returns:
- this builder instance
-
link
Creates a bidirectional link to the given state. Overrides any initial value set.- Parameters:
linkedState- a state to link to the component value- Returns:
- this builder instance
-
link
Creates a read-only link to the givenObservableState.- Parameters:
linkedState- a state to link to the component value- Returns:
- this builder instance
-
persistMenu
- Parameters:
persistMenu- specifies when a menu persists after a toggle button click- Returns:
- this builder instance
-
accelerator
Sets the accelerator displayed by the menu item, in place of any accelerator of its action.Note that Swing binds the accelerator as well, in the window of a menu bar containing the menu item, and while a popup menu containing it is showing.
- Parameters:
accelerator- the accelerator, null for the one of the action, if any- Returns:
- this builder instance
- See Also:
-