Java Gui Builder |
|
You are here: | Home > Documentation > JGB Elements Documentation > Item Element |
Group membership: Menu & items
Adds a new item to the enclosing menu.
Items are of three types: normal, check or radio.
normal menu items are the regular items that launch an action.
check menu items are items that have two states: on or off. They can be used for such actions as showing or hiding one item in the window.
radio menu items are items that group multiple choices together. They allow the user to select one item of a list of choices. Not unlike radio elements, radio menu items have a group attribute which names the group in which this particular item belongs to.
Name | Type | Required | Description | ||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
accelerator | CDATA | No |
Identifies the key combination that executes this menu item when pressed on the keyboard. The format of this attribute's value is such: Ctrl, Alt and Shift are modifier keys. Then, a single plus character (+) is specified, and finally, the character is added. The modifier keys (Ctrl, Shift and Alt) may be combined together to allow key combinations like Ctrl + Alt + X. It is also possible to use Java's KeyStroke class format to specify which accelerator key to use. |
||||||||
group | CDATA | No |
Declare the group in which this item will be a participant. Nothing prevents the use of the same group as one defined in a radio element. |
||||||||
id | ID | No |
Identifies the name by which this control will be referenced by other parts of the JGB XML file or Java code. |
||||||||
mnemonic | CDATA | No |
Identifies the character that will be used as this control's mnemonic. |
||||||||
refaction | IDREF | No |
More information forthcoming |
||||||||
selected | CDATA | No |
Determines if this item should be selected when the window opens. This attribute will be used only if the menu item's type is check or radio. Literal values
|
||||||||
text | CDATA | No |
Specifies the text that will appear on the control. Do not add an underline (_) or ampersand (&) to the text attribute to identify the mnemonic. Use this element's mnemonic attribute for that purpose. |
||||||||
type | CDATA | No |
Define the type of item that is being added to the menu. Literal values
|
… <menu id="fileMenu" text="File"> <item text="New" mnemonic="n" accelerator="Ctrl+N"/> <item text="Open..." mnemonic="o" accelerator="control o"/> … </menu> <menu id="viewMenu" text="View"> <!-- Add a checkable item to the view menu, and check it by default --> <item text="Status Bar" type="check" selected="true"/> <separator/> <!-- Add a nested menu item to the menu, allowing selection of the sort order --> <item text="Sort By" mnemonic="s"> <item text="Name" mnemonic="n" group="sortBy" type="radio" accelerator="Ctrl+Shift+F5" selected="true"/> <item text="Size" mnemonic="s" group="sortBy" type="radio" accelerator="Ctrl+Shift+F6"/> <item text="Date" mnemonic="d" group="sortBy" type="radio" accelerator="Ctrl+Shift+F7"/> <item text="Author" mnemonic="a" group="sortBy" type="radio" accelerator="Ctrl+Shift+F8"/> </item> </menu> …
Hosted on SourceForge.net |
Valid XHTML 1.0 ! |
Valid CSS ! |
Code Coverage provided by Clover |