JMenuBar (Java Platform SE 8 ) (original) (raw)

Modifier and Type

Method

Description

[JMenu](../../javax/swing/JMenu.html "class in javax.swing")

[add](../../javax/swing/JMenuBar.html#add-javax.swing.JMenu-)([JMenu](../../javax/swing/JMenu.html "class in javax.swing") c)

Appends the specified menu to the end of the menu bar.

void

[addNotify](../../javax/swing/JMenuBar.html#addNotify--)()

Overrides JComponent.addNotify to register this menu bar with the current keyboard manager.

[AccessibleContext](../../javax/accessibility/AccessibleContext.html "class in javax.accessibility")

[getAccessibleContext](../../javax/swing/JMenuBar.html#getAccessibleContext--)()

Gets the AccessibleContext associated with this JMenuBar.

[Component](../../java/awt/Component.html "class in java.awt")

[getComponent](../../javax/swing/JMenuBar.html#getComponent--)()

Implemented to be a MenuElement.

[Component](../../java/awt/Component.html "class in java.awt")

[getComponentAtIndex](../../javax/swing/JMenuBar.html#getComponentAtIndex-int-)(int i)

Deprecated.

replaced by getComponent(int i)

int

[getComponentIndex](../../javax/swing/JMenuBar.html#getComponentIndex-java.awt.Component-)([Component](../../java/awt/Component.html "class in java.awt") c)

Returns the index of the specified component.

[JMenu](../../javax/swing/JMenu.html "class in javax.swing")

[getHelpMenu](../../javax/swing/JMenuBar.html#getHelpMenu--)()

Gets the help menu for the menu bar.

[Insets](../../java/awt/Insets.html "class in java.awt")

[getMargin](../../javax/swing/JMenuBar.html#getMargin--)()

Returns the margin between the menubar's border and its menus.

[JMenu](../../javax/swing/JMenu.html "class in javax.swing")

[getMenu](../../javax/swing/JMenuBar.html#getMenu-int-)(int index)

Returns the menu at the specified position in the menu bar.

int

[getMenuCount](../../javax/swing/JMenuBar.html#getMenuCount--)()

Returns the number of items in the menu bar.

[SingleSelectionModel](../../javax/swing/SingleSelectionModel.html "interface in javax.swing")

[getSelectionModel](../../javax/swing/JMenuBar.html#getSelectionModel--)()

Returns the model object that handles single selections.

[MenuElement](../../javax/swing/MenuElement.html "interface in javax.swing")[]

[getSubElements](../../javax/swing/JMenuBar.html#getSubElements--)()

Implemented to be a MenuElement -- returns the menus in this menu bar.

[MenuBarUI](../../javax/swing/plaf/MenuBarUI.html "class in javax.swing.plaf")

[getUI](../../javax/swing/JMenuBar.html#getUI--)()

Returns the menubar's current UI.

[String](../../java/lang/String.html "class in java.lang")

[getUIClassID](../../javax/swing/JMenuBar.html#getUIClassID--)()

Returns the name of the L&F class that renders this component.

boolean

[isBorderPainted](../../javax/swing/JMenuBar.html#isBorderPainted--)()

Returns true if the menu bars border should be painted.

boolean

[isSelected](../../javax/swing/JMenuBar.html#isSelected--)()

Returns true if the menu bar currently has a component selected.

void

[menuSelectionChanged](../../javax/swing/JMenuBar.html#menuSelectionChanged-boolean-)(boolean isIncluded)

Implemented to be a MenuElement -- does nothing.

protected void

[paintBorder](../../javax/swing/JMenuBar.html#paintBorder-java.awt.Graphics-)([Graphics](../../java/awt/Graphics.html "class in java.awt") g)

Paints the menubar's border if BorderPainted property is true.

protected [String](../../java/lang/String.html "class in java.lang")

[paramString](../../javax/swing/JMenuBar.html#paramString--)()

Returns a string representation of this JMenuBar.

protected boolean

[processKeyBinding](../../javax/swing/JMenuBar.html#processKeyBinding-javax.swing.KeyStroke-java.awt.event.KeyEvent-int-boolean-)([KeyStroke](../../javax/swing/KeyStroke.html "class in javax.swing") ks,[KeyEvent](../../java/awt/event/KeyEvent.html "class in java.awt.event") e, int condition, boolean pressed)

Subclassed to check all the child menus.

void

[processKeyEvent](../../javax/swing/JMenuBar.html#processKeyEvent-java.awt.event.KeyEvent-javax.swing.MenuElement:A-javax.swing.MenuSelectionManager-)([KeyEvent](../../java/awt/event/KeyEvent.html "class in java.awt.event") e,[MenuElement](../../javax/swing/MenuElement.html "interface in javax.swing")[] path,[MenuSelectionManager](../../javax/swing/MenuSelectionManager.html "class in javax.swing") manager)

Implemented to be a MenuElement -- does nothing.

void

[processMouseEvent](../../javax/swing/JMenuBar.html#processMouseEvent-java.awt.event.MouseEvent-javax.swing.MenuElement:A-javax.swing.MenuSelectionManager-)([MouseEvent](../../java/awt/event/MouseEvent.html "class in java.awt.event") event,[MenuElement](../../javax/swing/MenuElement.html "interface in javax.swing")[] path,[MenuSelectionManager](../../javax/swing/MenuSelectionManager.html "class in javax.swing") manager)

Implemented to be a MenuElement -- does nothing.

void

[removeNotify](../../javax/swing/JMenuBar.html#removeNotify--)()

Overrides JComponent.removeNotify to unregister this menu bar with the current keyboard manager.

void

[setBorderPainted](../../javax/swing/JMenuBar.html#setBorderPainted-boolean-)(boolean b)

Sets whether the border should be painted.

void

[setHelpMenu](../../javax/swing/JMenuBar.html#setHelpMenu-javax.swing.JMenu-)([JMenu](../../javax/swing/JMenu.html "class in javax.swing") menu)

Sets the help menu that appears when the user selects the "help" option in the menu bar.

void

[setMargin](../../javax/swing/JMenuBar.html#setMargin-java.awt.Insets-)([Insets](../../java/awt/Insets.html "class in java.awt") m)

Sets the margin between the menubar's border and its menus.

void

[setSelected](../../javax/swing/JMenuBar.html#setSelected-java.awt.Component-)([Component](../../java/awt/Component.html "class in java.awt") sel)

Sets the currently selected component, producing a a change to the selection model.

void

[setSelectionModel](../../javax/swing/JMenuBar.html#setSelectionModel-javax.swing.SingleSelectionModel-)([SingleSelectionModel](../../javax/swing/SingleSelectionModel.html "interface in javax.swing") model)

Sets the model object to handle single selections.

void

[setUI](../../javax/swing/JMenuBar.html#setUI-javax.swing.plaf.MenuBarUI-)([MenuBarUI](../../javax/swing/plaf/MenuBarUI.html "class in javax.swing.plaf") ui)

Sets the L&F object that renders this component.

void

[updateUI](../../javax/swing/JMenuBar.html#updateUI--)()

Resets the UI property with a value from the current look and feel.