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.
  • Field Details

  • Method Details

    • toggle

      B 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.
      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

      B toggle(Supplier<ToggleControl> toggleControl)
      Parameters:
      toggleControl - the toggle control to base this toggle menu on
      Returns:
      this builder instance
    • link

      B link(State linkedState)
      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

      B link(ObservableState linkedState)
      Creates a read-only link to the given ObservableState.
      Parameters:
      linkedState - a state to link to the component value
      Returns:
      this builder instance
    • persistMenu

      B persistMenu(ToggleMenuItemBuilder.PersistMenu persistMenu)
      Parameters:
      persistMenu - specifies when a menu persists after a toggle button click
      Returns:
      this builder instance
    • accelerator

      B accelerator(@Nullable KeyStroke 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: