|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.jgoodies.uif.builder.MenuBuilder
public final class MenuBuilder
A builder that reduces the effort required to build, configure and fill a JMenu 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.
JMenu
,
Action
,
ToggleAction
,
UIFMenuItem
,
UIFCheckBoxMenuItem
,
UIFRadioButtonMenuItem
,
ToolBarBuilder
Constructor Summary | |
---|---|
MenuBuilder(JMenu menu)
Constructs a menu building using the given menu. |
|
MenuBuilder(String label,
char mnemonic)
Constructs menu bar 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. |
JMenu |
getMenu()
Returns the 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 MenuBuilder(String label, char mnemonic)
label
- the label for the built menumnemonic
- the shortcut for the build menupublic MenuBuilder(JMenu menu)
menu
- the menu to add items toMethod 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 JMenu getMenu()
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
NullPointerException
- if the action is null
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
NullPointerException
- if the action is null
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 |