MenuBar
The following panel contains a menubar on the top and a large text-area.
The menubar has only one menu ('Menu'), it has a menuitem ('MenuItem')
and a menu ('Menu'). The later's popup contains a menuitem with a selected
checkbox ('CheckBox'), a separator, and a radio button ('RadioButton'). <panel columns="1" gap="4">
<menubar weightx="1">
<menu text="Menu">
<menuitem text="MenuItem" icon="image.gif" />
<menu text="Menu">
<checkboxmenuitem text="CheckBox" selected="true" />
<separator />
<checkboxmenuitem text="RadioButton" group="group"/>
</menu>
</menu>
</menubar>
<textarea weighty="1" />
</panel>
Properties
placement | choice | top | Menubar may unfold the menus either downwards (default -
for menubars placed at the top of the container), or
upwards from the menubar position (bottom -
for menubars placed at the bottom of the container). |
name, enabled, visible, tooltip, property, width, height, colspan, rowspan,
weightx, weighty, halign, and valign parameters are similar to
component |
Menu
Menubar includes menu, and menu could contain menuitems, check or radio
button items, separators, and menus.
Properties
mnemonic | integer | -1 | Specifies the index of the underlined char and the key combination
(Alt + underlined character) which selects the menu. |
name, enabled, text, icon, alignment, tooltip, and property parameters
are similar to combobox choice |
MenuItem
A regular menu item can have either text or a graphic icon
associated with it, or both.
Properties
accelerator | keystroke | | The key combination which invokes the menuitem's action
method without navigating the menu hierarchy. |
mnemonic | integer | -1 | Specifies the underlined char index (thus the key combination)
which invokes the action listener. |
name, enabled, text, icon, alignment, tooltip, and property parameters
are similar to combobox choice |
Listeners
action | Invokes the given method when the menuitem is pressed by mouse or keyboard. |
CheckBoxMenuItem
A menu item that can be selected or deselected. The selected menuitem
appears with a checkmark next to it. A radio-button menu-item is a
menu item that is part of a group of menu items in which
only one item in the group can be selected.
Properties
selected | boolean | false | The state of the checkboxmenuitem. |
group | string | | Identifies a group if not null. Only one radio menuitem at a time
can be selected in a group.
User can set on a radio menuitem, the selected menuitem of the group will be set off
(the group members is searched only in the same menu). |
name, enabled, text, icon, alignment, tooltip, and property parameters
are similar to combobox choice |
mnemonic, accelerator, and action parameters are described at
menuitem |
Keyboard-actions
F10 | Moves focus to menu bar and posts first menu |
Up arrow | Selects previous item (or the last) |
Down arrow | Selects next item (or the first) |
Left arrow | Collapses last popupmenu, or selects previous (or the last) menu of menubar |
Right arrow | Expands menu, or selects next (or the first) menu of menubar |
Enter, Return, Spacebar | Activates a menu item, dismisses menu, and goes to last window item with focus |
Escape | Dismisses menu without taking action and returns focus to last component that had focus |
|