|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Object![]()
![]()
![]()
java.awt.Component
![]()
![]()
![]()
java.awt.Container
![]()
![]()
![]()
javax.swing.JComponent
![]()
![]()
![]()
javax.swing.JMenuBar
, MenuContainer
, Serializable
, Accessible
, MenuElement


public class JMenuBar

, MenuElement

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:
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 JavaBeansTM
has been added to the java.beans package.
Please see XMLEncoder
.
JMenu
,
JPopupMenu
,
JMenuItem
,
Serialized Form| Nested Class Summary | |
|---|---|
protected class |
JMenuBar.AccessibleJMenuBar
This class implements accessibility support for the JMenuBar class. |
Nested classes/interfaces inherited from class javax.swing.JComponent ![]() |
|---|
JComponent.AccessibleJComponent |
Nested classes/interfaces inherited from class java.awt.Container ![]() |
|---|
Container.AccessibleAWTContainer |
Nested classes/interfaces inherited from class java.awt.Component ![]() |
|---|
Component.AccessibleAWTComponent |
| Field Summary |
|---|
Fields inherited from class javax.swing.JComponent ![]() |
|---|
accessibleContext |
Fields inherited from class java.awt.Component ![]() |
|---|
BOTTOM_ALIGNMENT |
Fields inherited from interface java.awt.image.ImageObserver ![]() |
|---|
ABORT |
| Constructor Summary | |
|---|---|
JMenuBar
Creates a new menu bar. |
|
| Method Summary | |
|---|---|
JMenu |
add
Appends the specified menu to the end of the menu bar. |
void |
addNotify
Overrides JComponent.addNotify to register this
menu bar with the current keyboard manager. |
AccessibleContext |
getAccessibleContext
Gets the AccessibleContext associated with this JMenuBar. |
Component |
getComponent
Implemented to be a MenuElement. |
Component |
getComponentAtIndex
Deprecated. replaced by getComponent(int i) |
int |
getComponentIndex
Returns the index of the specified component. |
JMenu |
getHelpMenu
Gets the help menu for the menu bar. |
Insets |
getMargin
Returns the margin between the menubar's border and its menus. |
JMenu |
getMenu
Returns the menu at the specified position in the menu bar. |
int |
getMenuCount
Returns the number of items in the menu bar. |
SingleSelectionModel |
getSelectionModel
Returns the model object that handles single selections. |
MenuElement |
getSubElements
Implemented to be a MenuElement -- returns the
menus in this menu bar. |
MenuBarUI |
getUI
Returns the menubar's current UI. |
String |
getUIClassID
Returns the name of the L&F class that renders this component. |
boolean |
isBorderPainted
Returns true if the menu bars border should be painted. |
boolean |
isSelected
Returns true if the menu bar currently has a component selected. |
void |
menuSelectionChanged
Implemented to be a MenuElemen |
protected void |
paintBorder
Paints the menubar's border if BorderPainted
property is true. |
protected String |
paramString
Returns a string representation of this JMenuBar. |
protected boolean |
processKeyBinding
Subclassed to check all the child menus. |
void |
processKeyEvent
Implemented to be a MenuElement -- does nothing. |
void |
processMouseEvent
Implemented to be a MenuElement -- does nothing. |
void |
removeNotify
Overrides JComponent.removeNotify to unregister this
menu bar with the current keyboard manager. |
void |
setBorderPainted
Sets whether the border should be painted. |
void |
setHelpMenu
Sets the help menu that appears when the user selects the "help" option in the menu bar. |
void |
setMargin
Sets the margin between the menubar's border and its menus. |
void |
setSelected
Sets the currently selected component, producing a a change to the selection model. |
void |
setSelectionModel
Sets the model object to handle single selections. |
void |
setUI
Sets the L&F object that renders this component. |
void |
updateUI
Resets the UI property with a value from the current look and feel. |