Liking cljdoc? Tell your friends :D

jdk.awt.MenuItem

All items in a menu must belong to the class MenuItem, or one of its subclasses.

The default MenuItem object embodies a simple labeled menu item.

This picture of a menu bar shows five menu items:

The first two items are simple menu items, labeled "Basic" and "Simple". Following these two items is a separator, which is itself a menu item, created with the label "-". Next is an instance of CheckboxMenuItem labeled "Check". The final menu item is a submenu labeled "More Examples", and this submenu is an instance of Menu.

When a menu item is selected, AWT sends an action event to the menu item. Since the event is an instance of ActionEvent, the processEvent method examines the event and passes it along to processActionEvent. The latter method redirects the event to any ActionListener objects that have registered an interest in action events generated by this menu item.

Note that the subclass Menu overrides this behavior and does not send any event to the frame until one of its subitems is selected.

All items in a menu must belong to the class
MenuItem, or one of its subclasses.

The default MenuItem object embodies
a simple labeled menu item.

This picture of a menu bar shows five menu items:


The first two items are simple menu items, labeled
"Basic" and "Simple".
Following these two items is a separator, which is itself
a menu item, created with the label "-".
Next is an instance of CheckboxMenuItem
labeled "Check". The final menu item is a
submenu labeled "More Examples",
and this submenu is an instance of Menu.

When a menu item is selected, AWT sends an action event to
the menu item. Since the event is an
instance of ActionEvent, the processEvent
method examines the event and passes it along to
processActionEvent. The latter method redirects the
event to any ActionListener objects that have
registered an interest in action events generated by this
menu item.

Note that the subclass Menu overrides this behavior and
does not send any event to the frame until one of its subitems is
selected.
raw docstring

->menu-itemclj

(->menu-item)
(->menu-item label)
(->menu-item label s)

Constructor.

Create a menu item with an associated keyboard shortcut. Note that use of "-" in a label is reserved to indicate a separator between menu items. By default, all menu items except for separators are enabled.

label - the label for this menu item. - java.lang.String s - the instance of MenuShortcut associated with this menu item. - java.awt.MenuShortcut

throws: java.awt.HeadlessException - if GraphicsEnvironment.isHeadless() returns true.

Constructor.

Create a menu item with an associated keyboard shortcut.
 Note that use of "-" in a label is reserved to indicate
 a separator between menu items. By default, all menu
 items except for separators are enabled.

label - the label for this menu item. - `java.lang.String`
s - the instance of MenuShortcut associated with this menu item. - `java.awt.MenuShortcut`

throws: java.awt.HeadlessException - if GraphicsEnvironment.isHeadless() returns true.
raw docstring

add-action-listenerclj

(add-action-listener this l)

Adds the specified action listener to receive action events from this menu item. If l is null, no exception is thrown and no action is performed. Refer to AWT Threading Issues for details on AWT's threading model.

l - the action listener. - java.awt.event.ActionListener

Adds the specified action listener to receive action events
 from this menu item.
 If l is null, no exception is thrown and no action is performed.
 Refer to AWT Threading Issues for details on AWT's threading model.

l - the action listener. - `java.awt.event.ActionListener`
raw docstring

add-notifyclj

(add-notify this)

Creates the menu item's peer. The peer allows us to modify the appearance of the menu item without changing its functionality.

Creates the menu item's peer.  The peer allows us to modify the
appearance of the menu item without changing its functionality.
raw docstring

delete-shortcutclj

(delete-shortcut this)

Delete any MenuShortcut object associated with this menu item.

Delete any MenuShortcut object associated
with this menu item.
raw docstring

disableclj

(disable this)

Deprecated. As of JDK version 1.1, replaced by setEnabled(boolean).

Deprecated. As of JDK version 1.1,
replaced by setEnabled(boolean).
raw docstring

enableclj

(enable this)
(enable this b)

Deprecated. As of JDK version 1.1, replaced by setEnabled(boolean).

b - boolean

Deprecated. As of JDK version 1.1,
 replaced by setEnabled(boolean).

b - `boolean`
raw docstring

enabled?clj

(enabled? this)

Checks whether this menu item is enabled.

returns: boolean

Checks whether this menu item is enabled.

returns: `boolean`
raw docstring

get-accessible-contextclj

(get-accessible-context this)

Gets the AccessibleContext associated with this MenuItem. For menu items, the AccessibleContext takes the form of an AccessibleAWTMenuItem. A new AccessibleAWTMenuItem instance is created if necessary.

returns: an AccessibleAWTMenuItem that serves as the AccessibleContext of this MenuItem - javax.accessibility.AccessibleContext

Gets the AccessibleContext associated with this MenuItem.
 For menu items, the AccessibleContext takes the form of an
 AccessibleAWTMenuItem.
 A new AccessibleAWTMenuItem instance is created if necessary.

returns: an AccessibleAWTMenuItem that serves as the
         AccessibleContext of this MenuItem - `javax.accessibility.AccessibleContext`
raw docstring

get-action-commandclj

(get-action-command this)

Gets the command name of the action event that is fired by this menu item.

returns: java.lang.String

Gets the command name of the action event that is fired
 by this menu item.

returns: `java.lang.String`
raw docstring

get-action-listenersclj

(get-action-listeners this)

Returns an array of all the action listeners registered on this menu item.

returns: all of this menu item's ActionListeners or an empty array if no action listeners are currently registered - java.awt.event.ActionListener[]

Returns an array of all the action listeners
 registered on this menu item.

returns: all of this menu item's ActionListeners
         or an empty array if no action
         listeners are currently registered - `java.awt.event.ActionListener[]`
raw docstring

get-labelclj

(get-label this)

Gets the label for this menu item.

returns: the label of this menu item, or null if this menu item has no label. - java.lang.String

Gets the label for this menu item.

returns: the label of this menu item, or null
                       if this menu item has no label. - `java.lang.String`
raw docstring

get-listenersclj

(get-listeners this listener-type)

Returns an array of all the objects currently registered as FooListeners upon this MenuItem. FooListeners are registered using the addFooListener method.

You can specify the listenerType argument with a class literal, such as FooListener.class. For example, you can query a MenuItem m for its action listeners with the following code:

ActionListener[] als = (ActionListener[])(m.getListeners(ActionListener.class));

If no such listeners exist, this method returns an empty array.

listener-type - the type of listeners requested; this parameter should specify an interface that descends from java.util.EventListener - java.lang.Class

returns: an array of all objects registered as FooListeners on this menu item, or an empty array if no such listeners have been added - <T extends java.util.EventListener> T[]

throws: java.lang.ClassCastException - if listenerType doesn't specify a class or interface that implements java.util.EventListener

Returns an array of all the objects currently registered
 as FooListeners
 upon this MenuItem.
 FooListeners are registered using the
 addFooListener method.


 You can specify the listenerType argument
 with a class literal, such as
 FooListener.class.
 For example, you can query a
 MenuItem m
 for its action listeners with the following code:



ActionListener[] als = (ActionListener[])(m.getListeners(ActionListener.class));

 If no such listeners exist, this method returns an empty array.

listener-type - the type of listeners requested; this parameter should specify an interface that descends from java.util.EventListener - `java.lang.Class`

returns: an array of all objects registered as
          FooListeners on this menu item,
          or an empty array if no such
          listeners have been added - `<T extends java.util.EventListener> T[]`

throws: java.lang.ClassCastException - if listenerType doesn't specify a class or interface that implements java.util.EventListener
raw docstring

get-shortcutclj

(get-shortcut this)

Get the MenuShortcut object associated with this menu item,

returns: the menu shortcut associated with this menu item, or null if none has been specified. - java.awt.MenuShortcut

Get the MenuShortcut object associated with this
 menu item,

returns: the menu shortcut associated with this menu item,
                   or null if none has been specified. - `java.awt.MenuShortcut`
raw docstring

param-stringclj

(param-string this)

Returns a string representing the state of this MenuItem. 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 item - java.lang.String

Returns a string representing the state of this MenuItem.
 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 item - `java.lang.String`
raw docstring

remove-action-listenerclj

(remove-action-listener this l)

Removes the specified action listener so it no longer receives action events from this menu item. If l is null, no exception is thrown and no action is performed. Refer to AWT Threading Issues for details on AWT's threading model.

l - the action listener. - java.awt.event.ActionListener

Removes the specified action listener so it no longer receives
 action events from this menu item.
 If l is null, no exception is thrown and no action is performed.
 Refer to AWT Threading Issues for details on AWT's threading model.

l - the action listener. - `java.awt.event.ActionListener`
raw docstring

set-action-commandclj

(set-action-command this command)

Sets the command name of the action event that is fired by this menu item.

By default, the action command is set to the label of the menu item.

command - the action command to be set for this menu item. - java.lang.String

Sets the command name of the action event that is fired
 by this menu item.

 By default, the action command is set to the label of
 the menu item.

command - the action command to be set for this menu item. - `java.lang.String`
raw docstring

set-enabledclj

(set-enabled this b)

Sets whether or not this menu item can be chosen.

b - if true, enables this menu item; if false, disables it. - boolean

Sets whether or not this menu item can be chosen.

b - if true, enables this menu item; if false, disables it. - `boolean`
raw docstring

set-labelclj

(set-label this label)

Sets the label for this menu item to the specified label.

label - the new label, or null for no label. - java.lang.String

Sets the label for this menu item to the specified label.

label - the new label, or null for no label. - `java.lang.String`
raw docstring

set-shortcutclj

(set-shortcut this s)

Set the MenuShortcut object associated with this menu item. If a menu shortcut is already associated with this menu item, it is replaced.

s - the menu shortcut to associate with this menu item. - java.awt.MenuShortcut

Set the MenuShortcut object associated with this
 menu item. If a menu shortcut is already associated with
 this menu item, it is replaced.

s - the menu shortcut to associate with this menu item. - `java.awt.MenuShortcut`
raw docstring

cljdoc is a website building & hosting documentation for Clojure/Script libraries

× close