class org.aswing.JMenu extends JMenuItem
Interfaces | |||
![]() | MenuElement |
|
An implementation of a menu -- a popup window containing
JMenuItem
s that
is displayed when the user selects an item on the JMenuBar
.
In addition to JMenuItem
s, a JMenu
can
also contain JSeparator
s.
In essence, a menu is a button with an associated JPopupMenu
.
When the "button" is pressed, the JPopupMenu
appears. If the
"button" is on the JMenuBar
, the menu is a top-level window.
If the "button" is another menu item, then the JPopupMenu
is
"pull-right" menu.
@author paling
Instance Fields
The suggested delay, in milliseconds, before submenus are popped up or down.
Each look and feel (L&F) may determine its own policy for
observing the delay
property.
In most cases, the delay is not observed for top level menus
or while dragging. The default for delay
is 0.
This method is a property of the look and feel code and is used
to manage the idiosyncracies of the various UI implementations.
var popupMenuVisible:Bool
The visibility of the menu's popup. If the menu is not enabled, this method will have no effect.
function addMenuItem(s:String): JMenuItem
Creates a new menu item with the specified text and appends it to the end of this menu.
s | the string for the menu item to be added |
function getComponent(index:Int): Component
Returns the component at position index
.
n | the position of the component to be returned |
returns | the component requested, or |
function getComponentCount(): Int
Returns the number of components on the menu.
returns | an integer containing the number of components on the menu |
function insert(i:Int, c:Component): Void
Inserts a component(generally JMenuItem or JSeparator) to this menu.
function isMenuComponent(c:Component): Bool
Returns true if the specified component exists in the submenu hierarchy.
c | the |
returns | true if the |
function isTopLevelMenu(): Bool
Returns true if the menu is a 'top-level menu', that is, if it is the direct child of a menubar.
returns | true if the menu is activated from the menu bar; false if the menu is activated from a menu item on another menu |