- Type Parameters:
I
- The common type of theJMenuItem
which 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 theJSplitButton
display the text of the currently selectedJMenuItem
(button item).A convenient getter method for accessing the text displayed on theJSplitButton
.final I
Exposes theJMenuItem
which 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 underlyingSplitItemDelegate
instance.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 currentJMenuItem
by passingtrue
to 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 theJSplitButton
inside of your userAction
implementation.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 underlyingSplitItemDelegate
instance.- Returns:
- The
JSplitButton
to which thisSplitItem
(and itsJMenuItem
) belongs.
-
getCurrentItem
Exposes theJMenuItem
which is currently selected.- Returns:
- The
JMenuItem
which 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
JComponent
siblings 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
JComponent
which constitute the neighbouring UI components of the split button. except the currentJSplitButton
itself.
-
selectCurrentItem
- Returns:
- This delegate instance to allow for method chaining.
-
selectOnlyCurrentItem
Selects only the currentJMenuItem
by passingtrue
to theAbstractButton.setSelected(boolean)
method. All otherJMenuItem
s 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 theJSplitButton
display 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 theJSplitButton
inside of your userAction
implementation.- 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 theJMenuItem
which 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 theJMenuItem
which 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 theJMenuItem
which should be unselected.- Returns:
- This delegate instance to allow for method chaining.
-