|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.jgoodies.uif.builder.PopupMenuBuilder
public final class PopupMenuBuilder
A builder that reduces the effort required to build, configure and fill a JPopupMenu with menu items and separators. Provides several convenience methods that implicitly create extended menu item implementations or implicitly configure items to automatically handle typical platforms differences.
JPopupMenu
,
Action
,
ToggleAction
,
UIFMenuItem
,
UIFCheckBoxMenuItem
,
UIFRadioButtonMenuItem
,
ToolBarBuilder
Constructor Summary | |
---|---|
PopupMenuBuilder(JPopupMenu menu)
Constructs a popup menu builder using the given JPopupMenu. |
|
PopupMenuBuilder(String label)
Constructs a popup menu builder. |
Method Summary | |
---|---|
JMenuItem |
add(Action action)
Creates, adds and returns a UIFMenuItem that is
configured using the given plain Action. |
JMenuItem |
add(JMenuItem item)
Adds the given JMenuItem to this builder's menu. |
UIFMenuItem |
add(String text)
Creates a menu item for the specified text, adds it to this builder's menu and returns the new menu item. |
UIFMenuItem |
add(String text,
Icon icon)
Creates a menu item for the specified text and icon, adds it to this builder's menu and returns the new menu item. |
UIFMenuItem |
add(String text,
Icon icon,
int mnemonic)
Creates a menu item for the specified text and icon, adds it to this builder's menu and returns the new menu item. |
UIFMenuItem |
add(String text,
int mnemonic)
Creates a menu item for the specified text and icon, adds it to this builder's menu and returns the new menu item. |
UIFCheckBoxMenuItem |
add(UIFCheckBoxMenuItem item)
Adds the given UIFRadioButtonMenuItem to this builder's menu. |
UIFMenuItem |
add(UIFMenuItem item)
Adds the given UIFMenuItem to this builder's menu. |
UIFRadioButtonMenuItem |
add(UIFRadioButtonMenuItem item)
Adds the given UIFRadioButtonMenuItem to this builder's menu. |
void |
addSeparator()
Adds a separator to this builder's menu. |
JMenuItem |
addToggle(ToggleAction toggleAction)
Creates a radio button or check box menu item for the given ToggleAction , adds it to this builder's menu
and returns the new menu item. |
static Mode |
getIconVisibleDefaultMode()
Returns the default icon mode that is used as initial value of the iconVisibleMode property. |
Mode |
getIconVisibleMode()
Returns the current icon mode that determines whether menu items created by createActionComponent(Action) get an icon or not. |
JPopupMenu |
getPopupMenu()
Returns the popup menu that is built by this builder. |
static void |
setIconVisibleDefaultMode(Mode newDefaultMode)
Sets a new default icon mode that is used as initial value for the iconVisibleMode property. |
void |
setIconVisibleMode(Mode newMode)
Sets a new icon mode that determines whether menu items created by createActionComponent(Action) get an icon or not. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public PopupMenuBuilder(String label)
label
- the label for the built menupublic PopupMenuBuilder(JPopupMenu menu)
menu
- the menu used with this builderMethod Detail |
---|
public static Mode getIconVisibleDefaultMode()
public static void setIconVisibleDefaultMode(Mode newDefaultMode)
newDefaultMode
- the default icon mode to be setpublic Mode getIconVisibleMode()
createActionComponent(Action)
get an icon or not.
public void setIconVisibleMode(Mode newMode)
createActionComponent(Action)
get an icon or not.
newMode
- the icon mode to be setpublic JPopupMenu getPopupMenu()
public UIFMenuItem add(String text)
text
- the text for the menu item
public UIFMenuItem add(String text, Icon icon)
text
- the text for the menu itemicon
- the icon for the menu item
public UIFMenuItem add(String text, int mnemonic)
text
- the text for the menu itemmnemonic
- the mnemonic for the menu item
public UIFMenuItem add(String text, Icon icon, int mnemonic)
text
- the text for the menu itemicon
- the icon for the menu itemmnemonic
- the mnemonic for the menu item
public JMenuItem add(Action action)
UIFMenuItem
that is
configured using the given plain Action.
action
- the Action
for the menu item to be added
IllegalArgumentException
- if the action is an instance
of ToggleAction
public JMenuItem addToggle(ToggleAction toggleAction)
ToggleAction
, adds it to this builder's menu
and returns the new menu item.
toggleAction
- the Action
for the menu item to be added
public JMenuItem add(JMenuItem item)
item
- the menu item to add
public UIFMenuItem add(UIFMenuItem item)
item
- the menu item to add
public UIFRadioButtonMenuItem add(UIFRadioButtonMenuItem item)
item
- the menu item to add
public UIFCheckBoxMenuItem add(UIFCheckBoxMenuItem item)
item
- the menu item to add
public void addSeparator()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |