- Type Parameters:
I- The common type of theJMenuItemwhich is part of theJSplitButton.
This class is a delegate for events of the
JSplitButton component.
See UIForSplitButton.onSplitClick(Action) or UIForSplitButton.onSelection(Action)
for more information about where this delegate is used.-
Method Summary
Modifier and TypeMethodDescriptionappendToButtonText(String postfix) A convenience method to append text to the text displayed on theJSplitButton.Use this to conveniently make theJSplitButtondisplay the text of the currently selectedJMenuItem(button item).A convenient getter method for accessing the text displayed on theJSplitButton.final IExposes theJMenuItemwhich is currently selected.getEvent()The "siblinghood" of a component refers to all children of its parent component, including itself.The "siblings" of a component refer to all children of its parent component, except itself.Exposes the underlyingSplitItemDelegateinstance.prependToButtonText(String prefix) A convenience method to prepend text to the text displayed on theJSplitButton.selectItem(int i) Selects the targeted split item (JMenuItem).Selects only the currentJMenuItemby passingtrueto theAbstractButton.setSelected(boolean)method.selectOnlyItem(int i) Selects the targeted split item (JMenuItem) and unselects all other items.setButtonText(String text) Allows you to set the text displayed on theJSplitButtoninside of your userActionimplementation.unselectItem(int i) Unselects the targeted split item (JMenuItem).Methods inherited from class swingtree.AbstractDelegate
_component, _isUndefinedColor, _isUndefinedFont, _siblingsSource, animateFor, animateFor, animateFor, animateFor, animateStyleFor, animateStyleFor, find, find, find, findAll, findAllByGroup, findAllByGroup, findAllByGroup, findAllByGroup, get, getBackground, getBorder, getBounds, getCursor, getFont, getForeground, getHeight, getLocation, getMaxSize, getMinSize, getParent, getPrefSize, getScale, getSize, getTooltip, getWidth, getX, getY, isEnabled, isOpaque, isVisible, paint, paint, paint, paint, parentDelegate, scale, scale, scale, scale, setBackground, setBackgroundColor, setBackgroundColor, setBackgroundColor, setBackgroundColor, setBorder, setBounds, setBounds, setBounds, setCursor, setCursor, setEnabled, setFont, setForeground, setForegroundColor, setForegroundColor, setForegroundColor, setForegroundColor, setHeight, setMaxHeight, setMaxSize, setMaxSize, setMaxSize, setMaxWidth, setMinHeight, setMinSize, setMinSize, setMinSize, setMinWidth, setOpaque, setPrefHeight, setPrefSize, setPrefSize, setPrefSize, setPrefWidth, setSize, setSize, setSize, setTooltip, setVisible, setWidth, shapeOf, style
-
Method Details
-
getEvent
-
getSplitButton
Exposes the underlyingSplitItemDelegateinstance.- Returns:
- The
JSplitButtonto which thisSplitItem(and itsJMenuItem) belongs.
-
getCurrentItem
Exposes theJMenuItemwhich is currently selected.- Returns:
- The
JMenuItemwhich caused this action to be executed.
-
getSiblinghood
The "siblinghood" of a component refers to all children of its parent component, including itself. This is contrary to thegetSiblings()method which returns all children of the parent component except the current component.- Returns:
- A list of all the
JComponentsiblings of the split button, including the split button itself.
-
getSiblings
The "siblings" of a component refer to all children of its parent component, except itself. This is contrary to thegetSiblinghood()method which returns all children of the parent component including the current component.- Returns:
- A list of all the
JComponentwhich constitute the neighbouring UI components of the split button. except the currentJSplitButtonitself.
-
selectCurrentItem
- Returns:
- This delegate instance to allow for method chaining.
-
selectOnlyCurrentItem
Selects only the currentJMenuItemby passingtrueto theAbstractButton.setSelected(boolean)method. All otherJMenuItems will be unselected.- Returns:
- This delegate instance to allow for method chaining.
-
unselectCurrentItem
- Returns:
- This delegate instance to allow for method chaining.
-
unselectAllItems
- Returns:
- This delegate instance to allow for method chaining.
-
selectAllItems
- Returns:
- This delegate instance to allow for method chaining.
-
displayCurrentItemText
Use this to conveniently make theJSplitButtondisplay the text of the currently selectedJMenuItem(button item).- Returns:
- This delegate instance to allow for method chaining.
-
setButtonText
Allows you to set the text displayed on theJSplitButtoninside of your userActionimplementation.- Parameters:
text- The text which should be displayed on theJSplitButton.- Returns:
- This delegate instance to allow for method chaining.
-
getButtonText
A convenient getter method for accessing the text displayed on theJSplitButton. See alsosetButtonText(String)for setting the text displayed on theJSplitButton.- Returns:
- The text displayed on the
JSplitButton.
-
appendToButtonText
A convenience method to append text to the text displayed on theJSplitButton.- Parameters:
postfix- The text which should be appended to the text displayed on theJSplitButton.- Returns:
- This delegate instance to allow for method chaining.
-
prependToButtonText
A convenience method to prepend text to the text displayed on theJSplitButton.- Parameters:
prefix- The text which should be prepended to the text displayed on theJSplitButton.- Returns:
- This delegate instance to allow for method chaining.
-
selectItem
Selects the targeted split item (JMenuItem).- Parameters:
i- The item index of theJMenuItemwhich should be selected.- Returns:
- This delegate instance to allow for method chaining.
-
selectOnlyItem
Selects the targeted split item (JMenuItem) and unselects all other items.- Parameters:
i- The item index of theJMenuItemwhich should be selected exclusively.- Returns:
- This delegate instance to allow for method chaining.
-
unselectItem
Unselects the targeted split item (JMenuItem).- Parameters:
i- The item index of theJMenuItemwhich should be unselected.- Returns:
- This delegate instance to allow for method chaining.
-