All Packages  Class Hierarchy  This Package  Previous  Next  Index  

Class java.awt.swing.JMenuBar

java.lang.Object
    |
    +----java.awt.Component
            |
            +----java.awt.Container
                    |
                    +----java.awt.swing.JComponent
                            |
                            +----java.awt.swing.JMenuBar

public class JMenuBar
extends JComponent
implements Accessible
An implementation of a MenuBar


Constructor Index

 o JMenuBar()

Method Index

 o add(JMenu)
 o addAccessibleSelection(int)
Adds the nth selected item in the object to the object's selection.
 o clearAccessibleSelection()
Clears the selection in the object, so that nothing in the object is selected.
 o deleteShortcut(MenuShortcut)
 o getAccessibleRole()
Get the role of this object.
 o getAccessibleSelection(int)
Returns the currently selected menu if one is selected, otherwise null.
 o getAccessibleSelectionCount()
Returns 1 if a menu is currently selected in this menu bar.
 o getAccessibleStateSet()
Get the accessible state set of this object.
 o getComponentAtIndex(int)
 o getComponentIndex(Component)
 o getHelpMenu()
 o getMargin()
Returns the margin between the menubar's border and its menus.
 o getMenu(int)
 o getMenuCount()
 o getSelectionModel()
 o getShortcutMenuItem(MenuShortcut)
 o getShortcuts()
 o getUI()
Returns the menubar's current UI.
 o getUIClassID()
 o isBorderPainted()
 o isManagingFocus()
Override this method and return true if your JComponent manages focus.
 o isOpaque()
 o isSelected()
 o paintBorder(Graphics)
Paint the menubar's border if BorderPainted property is true.
 o remove(int)
Removes the component, specified by index, from this container.
 o removeAccessibleSelection(int)
Removes the nth selected item in the object from the object's selection.
 o setBorderPainted(boolean)
 o setHelpMenu(JMenu)
 o setMargin(Insets)
Sets the margin between the menubar's border and its menus.
 o setOpaque(boolean)
If true the buttons background will be filled with the background color.
 o setSelected(Component)
 o setSelectionModel(SingleSelectionModel)
 o setUI(MenuBarUI)
Sets the menubar's UI.
 o updateUI()
Gets a new UI object from the default UIFactory.

Constructors

 o JMenuBar
public JMenuBar()

Methods

 o getUI
public MenuBarUI getUI()
Returns the menubar's current UI.

See Also:
setUI
 o setUI
public void setUI(MenuBarUI ui)
Sets the menubar's UI.

Parameters:
ui - the new MenuBarUI
See Also:
getUI
 o updateUI
public void updateUI()
Gets a new UI object from the default UIFactory.

Overrides:
updateUI in class JComponent
 o getUIClassID
public String getUIClassID()
Returns:
"MenuBarUI"
Overrides:
getUIClassID in class JComponent
See Also:
getUIClassID, getUI
 o getSelectionModel
public SingleSelectionModel getSelectionModel()
 o setSelectionModel
public void setSelectionModel(SingleSelectionModel model)
 o add
public JMenu add(JMenu c)
 o getMenu
public JMenu getMenu(int index)
 o getMenuCount
public int getMenuCount()
 o remove
public void remove(int index)
Removes the component, specified by index, from this container.

Overrides:
remove in class Container
 o setHelpMenu
public void setHelpMenu(JMenu menu)
 o getHelpMenu
public JMenu getHelpMenu()
 o getShortcutMenuItem
public JMenuItem getShortcutMenuItem(MenuShortcut m)
 o getShortcuts
public Enumeration getShortcuts()
 o deleteShortcut
public void deleteShortcut(MenuShortcut m)
 o getComponentAtIndex
public Component getComponentAtIndex(int i)
 o getComponentIndex
public int getComponentIndex(Component c)
 o setSelected
public void setSelected(Component sel)
 o isSelected
public boolean isSelected()
 o isBorderPainted
public boolean isBorderPainted()
 o setBorderPainted
public void setBorderPainted(boolean s)
 o paintBorder
protected void paintBorder(Graphics g)
Paint the menubar's border if BorderPainted property is true.

Overrides:
paintBorder in class JComponent
See Also:
paint, setBorder
 o setMargin
public void setMargin(Insets margin)
Sets the margin between the menubar's border and its menus. Setting to null will cause the menubar to use the default margins.

 o getMargin
public Insets getMargin()
Returns the margin between the menubar's border and its menus.

 o setOpaque
public void setOpaque(boolean isOpaque)
If true the buttons background will be filled with the background color.

The default value of this property is true.

This is a JavaBeans bound property.

See Also:
isOpaque, getBackground
 o isOpaque
public boolean isOpaque()
Returns:
The value of the opaque property.
Overrides:
isOpaque in class JComponent
See Also:
setOpaque
 o getAccessibleStateSet
public AccessibleStateSet getAccessibleStateSet()
Get the accessible state set of this object.

Returns:
an instance of AccessibleState containing the current state of the object
Overrides:
getAccessibleStateSet in class JComponent
 o getAccessibleRole
public AccessibleRole getAccessibleRole()
Get the role of this object.

Returns:
an instance of AccessibleRole describing the role of the object
Overrides:
getAccessibleRole in class JComponent
 o getAccessibleSelectionCount
public int getAccessibleSelectionCount()
Returns 1 if a menu is currently selected in this menu bar.

Overrides:
getAccessibleSelectionCount in class JComponent
 o getAccessibleSelection
public Accessible getAccessibleSelection(int i)
Returns the currently selected menu if one is selected, otherwise null.

Overrides:
getAccessibleSelection in class JComponent
 o addAccessibleSelection
public void addAccessibleSelection(int i)
Adds the nth selected item in the object to the object's selection. If the object supports multiple selections, (the method getAccessibleStateSet returns a state that is MULTISELECTABLE) the nth item is added to any existing selection, otherwse it replaces any existing selection in the objct. If the nth item is already selected, this method has no effect.

Parameters:
i - the zero-based index of selectable items
Overrides:
addAccessibleSelection in class JComponent
See Also:
getAccessibleStateSet
 o removeAccessibleSelection
public void removeAccessibleSelection(int i)
Removes the nth selected item in the object from the object's selection. If the nth item isn't currently selected, this method has no effect.

Parameters:
i - the zero-based index of selectable items
Overrides:
removeAccessibleSelection in class JComponent
 o clearAccessibleSelection
public void clearAccessibleSelection()
Clears the selection in the object, so that nothing in the object is selected.

Overrides:
clearAccessibleSelection in class JComponent
 o isManagingFocus
public boolean isManagingFocus()
Override this method and return true if your JComponent manages focus.

Overrides:
isManagingFocus in class JComponent

All Packages  Class Hierarchy  This Package  Previous  Next  Index  

Submit a bug or feature