|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.cleancode.swing.JMenuItemSpec
public class JMenuItemSpec
A specification for a JMenuItem
used as a component
of a JMenuSpec
.
The specification includes: a JMenuItem
, an identifying
action command, the keyboard mnemonic, the keyboard accelerator,
the accelerator modifier key mask, and the enabled status of the menu item.
The assorted constructors provide for omitting combinations of these parameters.
The table below shows the values when omitted.
parameter | required? | default value | method to change default |
---|---|---|---|
JMenuItem |
required | NA | NA |
mnemonic key | optional | auto-assigned | none |
action command | required | NA | NA |
enabled status | optional | true |
setDefaultEnable |
accelerator key | optional | NA | none |
accelerator modifier mask | optional | ActionEvent.CTRL_MASK |
setDefaultAccModifier |
JMenuBarMgr
defines a menu bar consisting of JMenuSpec
items.
A JMenuSpec
defines a menu consisting of JMenuItemSpec
items.
JMenuSpec
,
JMenuBarMgr
Field Summary | |
---|---|
static String |
VERSION
Current version of this class. |
Constructor Summary | |
---|---|
JMenuItemSpec()
Creates a JMenuItemSpec which specifies a menu separator. |
|
JMenuItemSpec(JMenuItem mItem,
int mn,
String cmd,
boolean en)
Creates a JMenuItemSpec without an accelerator key. |
|
JMenuItemSpec(JMenuItem mItem,
int mn,
String cmd,
boolean en,
int acc)
Creates a JMenuItemSpec where the accelerator modifier
is determined by the default setting. |
|
JMenuItemSpec(JMenuItem mItem,
int mn,
String cmd,
boolean en,
int acc,
int accMod)
Creates a fully-specified JMenuItemSpec object. |
|
JMenuItemSpec(JMenuItem mItem,
int mn,
String cmd,
int acc,
int accMod)
Creates a JMenuItemSpec where the initial enabled status
is determined by the default setting. |
|
JMenuItemSpec(JMenuItem mItem,
String cmd)
Creates a JMenuItemSpec without an accelerator key,
where the initial enabled status is determined by the default setting,
and the mnemonic is auto-assigned. |
|
JMenuItemSpec(JMenuItem mItem,
String cmd,
boolean en)
Creates a JMenuItemSpec where the mnemonic is auto-assigned
and without an accelerator key. |
|
JMenuItemSpec(JMenuItem mItem,
String cmd,
boolean en,
int acc)
Creates a JMenuItemSpec where the accelerator modifier
is determined by the default setting and the mnemonic is auto-assigned. |
|
JMenuItemSpec(JMenuItem mItem,
String cmd,
boolean en,
int acc,
int accMod)
Creates a JMenuItemSpec where the mnemonic is auto-assigned. |
|
JMenuItemSpec(JMenuItem mItem,
String cmd,
int acc)
Creates a JMenuItemSpec where the initial enabled status
and the accelerator modifier are determined by the default setting,
and the mnemonic is auto-assigned. |
|
JMenuItemSpec(JMenuItem mItem,
String cmd,
int acc,
int accMod)
Creates a JMenuItemSpec where the initial enabled status
is determined by the default setting and the mnemonic is auto-assigned. |
Method Summary | |
---|---|
void |
setDefaultAccModifier(int newDefaultAccModifier)
Changes the default accelerator modifier used by the constructors which omit one. |
void |
setDefaultEnable(boolean enable)
Changes the default enabled status used by the constructors which omit one. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final String VERSION
Constructor Detail |
---|
public JMenuItemSpec(JMenuItem mItem, int mn, String cmd, boolean en, int acc, int accMod)
JMenuItemSpec
object.
mItem
- a JMenuItem
object to which the remaining parameters applymn
- a keyboard mnemonic (key which selects item when menu is open)cmd
- an action command for the menu item, used as an ID of the itemen
- a boolean flag indicating whether the menu item is initially enabledacc
- a keyboard accelerator (key which selects item without an open menu)accMod
- a modifier key for the acceleratorpublic JMenuItemSpec(JMenuItem mItem, int mn, String cmd, int acc, int accMod)
JMenuItemSpec
where the initial enabled status
is determined by the default setting.
mItem
- a JMenuItem
object to which the remaining parameters applymn
- a keyboard mnemonic (key which selects item when menu is open)cmd
- an action command for the menu item, used as an ID of the itemacc
- a keyboard accelerator (key which selects item without an open menu)accMod
- a modifier key for the accelerator (CTRL, ALT, SHIFT, or none)public JMenuItemSpec(JMenuItem mItem, int mn, String cmd, boolean en, int acc)
JMenuItemSpec
where the accelerator modifier
is determined by the default setting.
mItem
- a JMenuItem
object to which the remaining parameters applymn
- a keyboard mnemonic (key which selects item when menu is open)cmd
- an action command for the menu item, used as an ID of the itemen
- a boolean flag indicating whether the menu item is initially enabledacc
- a keyboard accelerator (key which selects item without an open menu)public JMenuItemSpec(JMenuItem mItem, String cmd, boolean en, int acc, int accMod)
JMenuItemSpec
where the mnemonic is auto-assigned.
mItem
- a JMenuItem
object to which the remaining parameters applycmd
- an action command for the menu item, used as an ID of the itemen
- a boolean flag indicating whether the menu item is initially enabledacc
- a keyboard accelerator (key which selects item without an open menu)accMod
- a modifier key for the accelerator (CTRL, ALT, SHIFT, or none)public JMenuItemSpec(JMenuItem mItem, int mn, String cmd, boolean en)
JMenuItemSpec
without an accelerator key.
mItem
- a JMenuItem
object to which the remaining parameters applymn
- a keyboard mnemonic (key which selects item when menu is open)cmd
- an action command for the menu item, used as an ID of the itemen
- a boolean flag indicating whether the menu item is initially enabledpublic JMenuItemSpec(JMenuItem mItem, String cmd, boolean en, int acc)
JMenuItemSpec
where the accelerator modifier
is determined by the default setting and the mnemonic is auto-assigned.
mItem
- a JMenuItem
object to which the remaining parameters applycmd
- an action command for the menu item, used as an ID of the itemen
- a boolean flag indicating whether the menu item is initially enabledacc
- a keyboard accelerator (key which selects item without an open menu)public JMenuItemSpec(JMenuItem mItem, String cmd, boolean en)
JMenuItemSpec
where the mnemonic is auto-assigned
and without an accelerator key.
mItem
- a JMenuItem
object to which the remaining parameters applycmd
- an action command for the menu item, used as an ID of the itemen
- a boolean flag indicating whether the menu item is initially enabledpublic JMenuItemSpec(JMenuItem mItem, String cmd, int acc, int accMod)
JMenuItemSpec
where the initial enabled status
is determined by the default setting and the mnemonic is auto-assigned.
mItem
- a JMenuItem object to which the remaining parameters applycmd
- an action command for the menu item, used as an ID of the itemacc
- a keyboard accelerator (key which selects item without an open menu)accMod
- a modifier key for the accelerator (CTRL, ALT, SHIFT, or none)public JMenuItemSpec(JMenuItem mItem, String cmd, int acc)
JMenuItemSpec
where the initial enabled status
and the accelerator modifier are determined by the default setting,
and the mnemonic is auto-assigned.
mItem
- a JMenuItem object to which the remaining parameters applycmd
- an action command for the menu item, used as an ID of the itemacc
- a keyboard accelerator (key which selects item without an open menu)public JMenuItemSpec(JMenuItem mItem, String cmd)
JMenuItemSpec
without an accelerator key,
where the initial enabled status is determined by the default setting,
and the mnemonic is auto-assigned.
mItem
- a JMenuItem object to which the remaining parameters applycmd
- an action command for the menu item, used as an ID of the itempublic JMenuItemSpec()
JMenuItemSpec
which specifies a menu separator.
Method Detail |
---|
public void setDefaultAccModifier(int newDefaultAccModifier)
ActionEvent
.ALT_MASK, ActionEvent
.CTRL_MASK,
ActionEvent
.SHIFT_MASK, or ActionEvent
.META_MASK
Each of these is a bit flag; they may be combined
by logical OR operations (for example, to use SHIFT and ALT together).
Alternately, the absence of any bits (a zero value) indicates to use no
modifier key.
newDefaultAccModifier
- a modifier mask for the accelerator keypublic void setDefaultEnable(boolean enable)
enable
- an initial enabled status for menu items
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
CleanCode Java Libraries | Copyright © 2001-2012 Michael Sorens - Revised 2012.12.10 |