A Menu object is a pull-down menu component that is deployed from a menu bar.
A menu can optionally be a tear-off menu. A tear-off menu can be opened and dragged away from its parent menu bar or menu. It remains on the screen after the mouse button has been released. The mechanism for tearing off a menu is platform dependent, since the look and feel of the tear-off menu is determined by its peer. On platforms that do not support tear-off menus, the tear-off property is ignored.
Each item in a menu must belong to the MenuItem class. It can be an instance of MenuItem, a submenu (an instance of Menu), or a check box (an instance of CheckboxMenuItem).
A Menu object is a pull-down menu component that is deployed from a menu bar. A menu can optionally be a tear-off menu. A tear-off menu can be opened and dragged away from its parent menu bar or menu. It remains on the screen after the mouse button has been released. The mechanism for tearing off a menu is platform dependent, since the look and feel of the tear-off menu is determined by its peer. On platforms that do not support tear-off menus, the tear-off property is ignored. Each item in a menu must belong to the MenuItem class. It can be an instance of MenuItem, a submenu (an instance of Menu), or a check box (an instance of CheckboxMenuItem).
(->menu)
(->menu label)
(->menu label tear-off)
Constructor.
Constructs a new menu with the specified label, indicating whether the menu can be torn off.
Tear-off functionality may not be supported by all implementations of AWT. If a particular implementation doesn't support tear-off menus, this value is silently ignored.
label - the menu's label in the menu bar, or in another menu of which this menu is a submenu. - java.lang.String
tear-off - if true, the menu is a tear-off menu. - boolean
throws: java.awt.HeadlessException - if GraphicsEnvironment.isHeadless() returns true.
Constructor. Constructs a new menu with the specified label, indicating whether the menu can be torn off. Tear-off functionality may not be supported by all implementations of AWT. If a particular implementation doesn't support tear-off menus, this value is silently ignored. label - the menu's label in the menu bar, or in another menu of which this menu is a submenu. - `java.lang.String` tear-off - if true, the menu is a tear-off menu. - `boolean` throws: java.awt.HeadlessException - if GraphicsEnvironment.isHeadless() returns true.
(add this mi)
Adds the specified menu item to this menu. If the menu item has been part of another menu, removes it from that menu.
mi - the menu item to be added - java.awt.MenuItem
returns: the menu item added - java.awt.MenuItem
Adds the specified menu item to this menu. If the menu item has been part of another menu, removes it from that menu. mi - the menu item to be added - `java.awt.MenuItem` returns: the menu item added - `java.awt.MenuItem`
(add-notify this)
Creates the menu's peer. The peer allows us to modify the appearance of the menu without changing its functionality.
Creates the menu's peer. The peer allows us to modify the appearance of the menu without changing its functionality.
(add-separator this)
Adds a separator line, or a hypen, to the menu at the current position.
Adds a separator line, or a hypen, to the menu at the current position.
(count-items this)
Deprecated. As of JDK version 1.1, replaced by getItemCount().
returns: int
Deprecated. As of JDK version 1.1, replaced by getItemCount(). returns: `int`
(get-accessible-context this)
Gets the AccessibleContext associated with this Menu. For menus, the AccessibleContext takes the form of an AccessibleAWTMenu. A new AccessibleAWTMenu instance is created if necessary.
returns: an AccessibleAWTMenu that serves as the
AccessibleContext of this Menu - javax.accessibility.AccessibleContext
Gets the AccessibleContext associated with this Menu. For menus, the AccessibleContext takes the form of an AccessibleAWTMenu. A new AccessibleAWTMenu instance is created if necessary. returns: an AccessibleAWTMenu that serves as the AccessibleContext of this Menu - `javax.accessibility.AccessibleContext`
(get-item this index)
Gets the item located at the specified index of this menu.
index - the position of the item to be returned. - int
returns: the item located at the specified index. - java.awt.MenuItem
Gets the item located at the specified index of this menu. index - the position of the item to be returned. - `int` returns: the item located at the specified index. - `java.awt.MenuItem`
(get-item-count this)
Get the number of items in this menu.
returns: the number of items in this menu. - int
Get the number of items in this menu. returns: the number of items in this menu. - `int`
(insert this menuitem index)
Inserts a menu item into this menu at the specified position.
menuitem - the menu item to be inserted. - java.awt.MenuItem
index - the position at which the menu item should be inserted. - int
throws: java.lang.IllegalArgumentException - if the value of index is less than zero
Inserts a menu item into this menu at the specified position. menuitem - the menu item to be inserted. - `java.awt.MenuItem` index - the position at which the menu item should be inserted. - `int` throws: java.lang.IllegalArgumentException - if the value of index is less than zero
(insert-separator this index)
Inserts a separator at the specified position.
index - the position at which the menu separator should be inserted. - int
throws: java.lang.IllegalArgumentException - if the value of index is less than 0.
Inserts a separator at the specified position. index - the position at which the menu separator should be inserted. - `int` throws: java.lang.IllegalArgumentException - if the value of index is less than 0.
(param-string this)
Returns a string representing the state of this Menu. This method is intended to be used only for debugging purposes, and the content and format of the returned string may vary between implementations. The returned string may be empty but may not be null.
returns: the parameter string of this menu - java.lang.String
Returns a string representing the state of this Menu. This method is intended to be used only for debugging purposes, and the content and format of the returned string may vary between implementations. The returned string may be empty but may not be null. returns: the parameter string of this menu - `java.lang.String`
(remove this index)
Removes the menu item at the specified index from this menu.
index - the position of the item to be removed. - int
Removes the menu item at the specified index from this menu. index - the position of the item to be removed. - `int`
(remove-all this)
Removes all items from this menu.
Removes all items from this menu.
(remove-notify this)
Removes the menu's peer. The peer allows us to modify the appearance of the menu without changing its functionality.
Removes the menu's peer. The peer allows us to modify the appearance of the menu without changing its functionality.
(tear-off? this)
Indicates whether this menu is a tear-off menu.
Tear-off functionality may not be supported by all implementations of AWT. If a particular implementation doesn't support tear-off menus, this value is silently ignored.
returns: true if this is a tear-off menu;
false otherwise. - boolean
Indicates whether this menu is a tear-off menu. Tear-off functionality may not be supported by all implementations of AWT. If a particular implementation doesn't support tear-off menus, this value is silently ignored. returns: true if this is a tear-off menu; false otherwise. - `boolean`
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close