All Packages  Class Hierarchy  This Package  Previous  Next  Index  

Class java.awt.swing.JMenu

java.lang.Object
    |
    +----java.awt.Component
            |
            +----java.awt.Container
                    |
                    +----java.awt.swing.JComponent
                            |
                            +----java.awt.swing.AbstractButton
                                    |
                                    +----java.awt.swing.JMenuItem
                                            |
                                            +----java.awt.swing.JMenu

public class JMenu
extends JMenuItem
implements Accessible
An implementation of a Menu


Class Index

 o JMenu.WinListener

Variable Index

 o popupListener
 o ui

Constructor Index

 o JMenu()
 o JMenu(String)
 o JMenu(String, boolean)

Method Index

 o add(Action)
 o add(Component)
Adds the specified component to the end of this container.
 o add(JMenuItem)
 o add(String)
 o addMenuListener(MenuListener)
 o addSeparator()
 o createWinListener(JPopupMenu)
 o fireMenuDeselected()
 o fireMenuSelected()
 o getAccessibleChild(int)
Return the nth Accessible child of the object.
 o getAccessibleChildrenCount()
Returns the number of accessible children in the object.
 o getAccessibleRole()
Get the role of this object.
 o getDelay()
Returns the suggested delay before the menu's PopupMenu is popped up or down.
 o getItem(int)
 o getItemCount()
 o getMenuComponent(int)
 o getMenuComponentCount()
 o getMenuComponents()
 o getPopupMenu()
 o getUIClassID()
 o insert(Action, int)
 o insert(JMenuItem, int)
 o insert(String, int)
 o insertSeparator(int)
Inserts a separator at the specified position.
 o isMenuComponent(Component)
Returns true if the component c exists in the submenu hierarchy.
 o isPopupMenuVisible()
 o isSelected()
Returns the state of the button.
 o isTearOff()
 o isTopLevelMenu()
 o paramString()
Gets the parameter string representing the state of this menu.
 o remove(Action)
 o remove(int)
Removes the menu item at the specified index from this menu.
 o remove(JMenuItem)
Removes the specified menu item from this menu.
 o removeAll()
Removes all the components from this container.
 o removeMenuListener(MenuListener)
 o setDelay(int)
Sets the suggested delay before the menu's PopupMenu is popped up or down.
 o setMenuLocation(int, int)
 o setModel(ButtonModel)
Set the model that this button represents.
 o setPopupMenuVisible(boolean)
 o setSelected(boolean)
Sets the state of the button.
 o setUI(MenuUI)
Sets the menu's UI.
 o updateUI()
Gets a new UI object from the default UIFactory.

Variables

 o ui
protected MenuUI ui
 o popupListener
protected JMenu.WinListener popupListener

Constructors

 o JMenu
public JMenu()
 o JMenu
public JMenu(String s)
 o JMenu
public JMenu(String s,
             boolean b)

Methods

 o setUI
public void setUI(MenuUI ui)
Sets the menu's UI.

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

Overrides:
updateUI in class JMenuItem
 o getUIClassID
public String getUIClassID()
Returns:
"MenuUI"
Overrides:
getUIClassID in class JMenuItem
See Also:
getUIClassID, getUI
 o setModel
public void setModel(ButtonModel newModel)
Set the model that this button represents.

Parameters:
m - the Model
Overrides:
setModel in class AbstractButton
See Also:
getModel
 o isSelected
public boolean isSelected()
Returns the state of the button.

Overrides:
isSelected in class AbstractButton
 o setSelected
public void setSelected(boolean b)
Sets the state of the button.

Overrides:
setSelected in class AbstractButton
 o isPopupMenuVisible
public boolean isPopupMenuVisible()
 o setPopupMenuVisible
public void setPopupMenuVisible(boolean b)
 o getDelay
public int getDelay()
Returns the suggested delay before the menu's PopupMenu is popped up or down.

 o setDelay
public void setDelay(int d)
Sets the suggested delay before the menu's PopupMenu is popped up or down.

Parameters:
d - the number of milliseconds to delay
Throws: IllegalArgumentException
if the value of d is less than 0.
 o setMenuLocation
public void setMenuLocation(int x,
                            int y)
 o add
public JMenuItem add(JMenuItem menuItem)
 o add
public Component add(Component c)
Adds the specified component to the end of this container.

Overrides:
add in class Container
 o add
public void add(String s)
 o add
public JMenuItem add(Action a)
 o addSeparator
public void addSeparator()
 o insert
public void insert(String s,
                   int pos)
 o insert
public JMenuItem insert(JMenuItem mi,
                        int pos)
 o insert
public JMenuItem insert(Action a,
                        int pos)
 o insertSeparator
public void insertSeparator(int index)
Inserts a separator at the specified position.

Parameters:
index - the position at which the menu separator should be inserted.
Throws: IllegalArgumentException
if the value of index is less than 0.
 o getItem
public JMenuItem getItem(int pos)
 o getItemCount
public int getItemCount()
 o isTearOff
public boolean isTearOff()
 o remove
public void remove(JMenuItem item)
Removes the specified menu item from this menu.

Parameters:
item - the item to be removed from the menu
 o remove
public void remove(Action a)
 o remove
public void remove(int pos)
Removes the menu item at the specified index from this menu.

Parameters:
index - the position of the item to be removed.
Throws: IllegalArgumentException
if the value of index is less than 0.
Overrides:
remove in class Container
 o removeAll
public void removeAll()
Removes all the components from this container.

Overrides:
removeAll in class Container
 o getMenuComponentCount
public int getMenuComponentCount()
 o getMenuComponent
public Component getMenuComponent(int n)
 o getMenuComponents
public Component[] getMenuComponents()
 o paramString
public String paramString()
Gets the parameter string representing the state of this menu. This string is useful for debugging.

Overrides:
paramString in class Container
 o isTopLevelMenu
public boolean isTopLevelMenu()
 o isMenuComponent
public boolean isMenuComponent(Component c)
Returns true if the component c exists in the submenu hierarchy.

Parameters:
c - the component to be tested
 o getPopupMenu
public JPopupMenu getPopupMenu()
 o addMenuListener
public void addMenuListener(MenuListener l)
 o removeMenuListener
public void removeMenuListener(MenuListener l)
 o fireMenuSelected
protected void fireMenuSelected()
 o fireMenuDeselected
protected void fireMenuDeselected()
 o createWinListener
protected JMenu.WinListener createWinListener(JPopupMenu p)
 o getAccessibleChildrenCount
public int getAccessibleChildrenCount()
Returns the number of accessible children in the object. If all of the children of this object implement Accessible, than this method should return the number of children of this object.

Returns:
the number of accessible children in the object.
Overrides:
getAccessibleChildrenCount in class JComponent
 o getAccessibleChild
public Accessible getAccessibleChild(int i)
Return the nth Accessible child of the object.

Parameters:
i - zero-based index of child
Returns:
the nth Accessible child of the object
Overrides:
getAccessibleChild 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 JMenuItem
See Also:
AccessibleRole

All Packages  Class Hierarchy  This Package  Previous  Next  Index  

Submit a bug or feature