An implementation of a menu bar. You add JMenu objects to the menu bar to construct a menu. When the user selects a JMenu object, its associated JPopupMenu is displayed, allowing the user to select one of the JMenuItems on it.
For information and examples of using menu bars see How to Use Menus, a section in The Java Tutorial.
Warning: Swing is not thread safe. For more information see Swing's Threading Policy.
Warning: Serialized objects of this class will not be compatible with future Swing releases. The current serialization support is appropriate for short term storage or RMI between applications running the same version of Swing. As of 1.4, support for long term storage of all JavaBeans™ has been added to the java.beans package. Please see XMLEncoder.
Warning: By default, pressing the Tab key does not transfer focus from a JMenuBar which is added to a container together with other Swing components, because the focusTraversalKeysEnabled property of JMenuBar is set to false. To resolve this, you should call the JMenuBar.setFocusTraversalKeysEnabled(true) method.
An implementation of a menu bar. You add JMenu objects to the menu bar to construct a menu. When the user selects a JMenu object, its associated JPopupMenu is displayed, allowing the user to select one of the JMenuItems on it. For information and examples of using menu bars see How to Use Menus, a section in The Java Tutorial. Warning: Swing is not thread safe. For more information see Swing's Threading Policy. Warning: Serialized objects of this class will not be compatible with future Swing releases. The current serialization support is appropriate for short term storage or RMI between applications running the same version of Swing. As of 1.4, support for long term storage of all JavaBeans™ has been added to the java.beans package. Please see XMLEncoder. Warning: By default, pressing the Tab key does not transfer focus from a JMenuBar which is added to a container together with other Swing components, because the focusTraversalKeysEnabled property of JMenuBar is set to false. To resolve this, you should call the JMenuBar.setFocusTraversalKeysEnabled(true) method.
(->j-menu-bar)
Constructor.
Creates a new menu bar.
Constructor. Creates a new menu bar.
(add this c)
Appends the specified menu to the end of the menu bar.
c - the JMenu component to add - javax.swing.JMenu
returns: the menu component - javax.swing.JMenu
Appends the specified menu to the end of the menu bar. c - the JMenu component to add - `javax.swing.JMenu` returns: the menu component - `javax.swing.JMenu`
(add-notify this)
Overrides JComponent.addNotify to register this menu bar with the current keyboard manager.
Overrides JComponent.addNotify to register this menu bar with the current keyboard manager.
(border-painted? this)
Returns true if the menu bars border should be painted.
returns: true if the border should be painted, else false - boolean
Returns true if the menu bars border should be painted. returns: true if the border should be painted, else false - `boolean`
(get-accessible-context this)
Gets the AccessibleContext associated with this JMenuBar. For JMenuBars, the AccessibleContext takes the form of an AccessibleJMenuBar. A new AccessibleJMenuBar instance is created if necessary.
returns: an AccessibleJMenuBar that serves as the
AccessibleContext of this JMenuBar - javax.accessibility.AccessibleContext
Gets the AccessibleContext associated with this JMenuBar. For JMenuBars, the AccessibleContext takes the form of an AccessibleJMenuBar. A new AccessibleJMenuBar instance is created if necessary. returns: an AccessibleJMenuBar that serves as the AccessibleContext of this JMenuBar - `javax.accessibility.AccessibleContext`
(get-component this)
Implemented to be a MenuElement. Returns this object.
returns: the current Component (this) - java.awt.Component
Implemented to be a MenuElement. Returns this object. returns: the current Component (this) - `java.awt.Component`
(get-component-at-index this i)
Deprecated. replaced by getComponent(int i)
i - an integer specifying the position, where 0 is first - int
returns: the Component at the position,
or null for an invalid index - java.awt.Component
Deprecated. replaced by getComponent(int i) i - an integer specifying the position, where 0 is first - `int` returns: the Component at the position, or null for an invalid index - `java.awt.Component`
(get-component-index this c)
Returns the index of the specified component.
c - the Component to find - java.awt.Component
returns: an integer giving the component's position, where 0 is first;
or -1 if it can't be found - int
Returns the index of the specified component. c - the Component to find - `java.awt.Component` returns: an integer giving the component's position, where 0 is first; or -1 if it can't be found - `int`
(get-help-menu this)
Gets the help menu for the menu bar. This method is not yet implemented and will throw an exception.
returns: the JMenu that delivers help to the user - javax.swing.JMenu
Gets the help menu for the menu bar. This method is not yet implemented and will throw an exception. returns: the JMenu that delivers help to the user - `javax.swing.JMenu`
(get-margin this)
Returns the margin between the menubar's border and its menus. If there is no previous margin, it will create a default margin with zero size.
returns: an Insets object containing the margin values - java.awt.Insets
Returns the margin between the menubar's border and its menus. If there is no previous margin, it will create a default margin with zero size. returns: an Insets object containing the margin values - `java.awt.Insets`
(get-menu this index)
Returns the menu at the specified position in the menu bar.
index - an integer giving the position in the menu bar, where 0 is the first position - int
returns: the JMenu at that position, or null if
if there is no JMenu at that position (ie. if
it is a JMenuItem) - javax.swing.JMenu
Returns the menu at the specified position in the menu bar. index - an integer giving the position in the menu bar, where 0 is the first position - `int` returns: the JMenu at that position, or null if if there is no JMenu at that position (ie. if it is a JMenuItem) - `javax.swing.JMenu`
(get-menu-count this)
Returns the number of items in the menu bar.
returns: the number of items in the menu bar - int
Returns the number of items in the menu bar. returns: the number of items in the menu bar - `int`
(get-selection-model this)
Returns the model object that handles single selections.
returns: the SingleSelectionModel property - javax.swing.SingleSelectionModel
Returns the model object that handles single selections. returns: the SingleSelectionModel property - `javax.swing.SingleSelectionModel`
(get-sub-elements this)
Implemented to be a MenuElement -- returns the menus in this menu bar. This is the reason for implementing the MenuElement interface -- so that the menu bar can be treated the same as other menu elements.
returns: an array of menu items in the menu bar. - javax.swing.MenuElement[]
Implemented to be a MenuElement -- returns the menus in this menu bar. This is the reason for implementing the MenuElement interface -- so that the menu bar can be treated the same as other menu elements. returns: an array of menu items in the menu bar. - `javax.swing.MenuElement[]`
(get-ui this)
Returns the menubar's current UI.
returns: javax.swing.plaf.MenuBarUI
Returns the menubar's current UI. returns: `javax.swing.plaf.MenuBarUI`
(get-ui-class-id this)
Returns the name of the L&F class that renders this component.
returns: the string "MenuBarUI" - java.lang.String
Returns the name of the L&F class that renders this component. returns: the string "MenuBarUI" - `java.lang.String`
(menu-selection-changed this is-included)
Implemented to be a MenuElement -- does nothing.
is-included - boolean
Implemented to be a MenuElement -- does nothing. is-included - `boolean`
(process-key-event this e path manager)
Implemented to be a MenuElement -- does nothing.
e - java.awt.event.KeyEvent
path - javax.swing.MenuElement[]
manager - javax.swing.MenuSelectionManager
Implemented to be a MenuElement -- does nothing. e - `java.awt.event.KeyEvent` path - `javax.swing.MenuElement[]` manager - `javax.swing.MenuSelectionManager`
(process-mouse-event this event path manager)
Implemented to be a MenuElement -- does nothing.
event - java.awt.event.MouseEvent
path - javax.swing.MenuElement[]
manager - javax.swing.MenuSelectionManager
Implemented to be a MenuElement -- does nothing. event - `java.awt.event.MouseEvent` path - `javax.swing.MenuElement[]` manager - `javax.swing.MenuSelectionManager`
(remove-notify this)
Overrides JComponent.removeNotify to unregister this menu bar with the current keyboard manager.
Overrides JComponent.removeNotify to unregister this menu bar with the current keyboard manager.
(selected? this)
Returns true if the menu bar currently has a component selected.
returns: true if a selection has been made, else false - boolean
Returns true if the menu bar currently has a component selected. returns: true if a selection has been made, else false - `boolean`
(set-border-painted this b)
Sets whether the border should be painted.
b - if true and border property is not null, the border is painted. - boolean
Sets whether the border should be painted. b - if true and border property is not null, the border is painted. - `boolean`
(set-help-menu this menu)
Sets the help menu that appears when the user selects the "help" option in the menu bar. This method is not yet implemented and will throw an exception.
menu - the JMenu that delivers help to the user - javax.swing.JMenu
Sets the help menu that appears when the user selects the "help" option in the menu bar. This method is not yet implemented and will throw an exception. menu - the JMenu that delivers help to the user - `javax.swing.JMenu`
(set-margin this m)
Sets the margin between the menubar's border and its menus. Setting to null will cause the menubar to use the default margins.
m - an Insets object containing the margin values - java.awt.Insets
Sets the margin between the menubar's border and its menus. Setting to null will cause the menubar to use the default margins. m - an Insets object containing the margin values - `java.awt.Insets`
(set-selected this sel)
Sets the currently selected component, producing a a change to the selection model.
sel - the Component to select - java.awt.Component
Sets the currently selected component, producing a a change to the selection model. sel - the Component to select - `java.awt.Component`
(set-selection-model this model)
Sets the model object to handle single selections.
model - the SingleSelectionModel to use - javax.swing.SingleSelectionModel
Sets the model object to handle single selections. model - the SingleSelectionModel to use - `javax.swing.SingleSelectionModel`
(set-ui this ui)
Sets the L&F object that renders this component.
ui - the new MenuBarUI L&F object - javax.swing.plaf.MenuBarUI
Sets the L&F object that renders this component. ui - the new MenuBarUI L&F object - `javax.swing.plaf.MenuBarUI`
(update-ui this)
Resets the UI property with a value from the current look and feel.
Resets the UI property with a value from the current look and feel.
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close