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
JMenu.WinListener-
popupListener-
ui-
JMenu()
-
JMenu(String)
-
JMenu(String, boolean)
-
add(Action)
-
add(Component)
- Adds the specified component to the end of this container.
add(JMenuItem)
-
add(String)
-
addMenuListener(MenuListener)
-
addSeparator()
-
createWinListener(JPopupMenu)
-
fireMenuDeselected()
-
fireMenuSelected()
-
getAccessibleChild(int)
- Return the nth Accessible child of the object.
getAccessibleChildrenCount()
- Returns the number of accessible children in the object.
getAccessibleRole()
- Get the role of this object.
getDelay()
- Returns the suggested delay before the menu's PopupMenu is popped up or down.
getItem(int)
-
getItemCount()
-
getMenuComponent(int)
-
getMenuComponentCount()
-
getMenuComponents()
-
getPopupMenu()
-
getUIClassID()
-
insert(Action, int)
-
insert(JMenuItem, int)
-
insert(String, int)
-
insertSeparator(int)
- Inserts a separator at the specified position.
isMenuComponent(Component)
- Returns true if the component c exists in the submenu hierarchy.
isPopupMenuVisible()
-
isSelected()
- Returns the state of the button.
isTearOff()
-
isTopLevelMenu()
-
paramString()
- Gets the parameter string representing the state of this menu.
remove(Action)
-
remove(int)
- Removes the menu item at the specified index from this menu.
remove(JMenuItem)
- Removes the specified menu item from this menu.
removeAll()
- Removes all the components from this container.
removeMenuListener(MenuListener)
-
setDelay(int)
- Sets the suggested delay before the menu's PopupMenu is popped up or down.
setMenuLocation(int, int)
-
setModel(ButtonModel)
- Set the model that this button represents.
setPopupMenuVisible(boolean)
-
setSelected(boolean)
- Sets the state of the button.
setUI(MenuUI)
- Sets the menu's UI.
updateUI()
- Gets a new UI object from the default UIFactory.
ui
protected MenuUI ui
popupListener
protected JMenu.WinListener popupListener
JMenu
public JMenu()
JMenu
public JMenu(String s)
JMenu
public JMenu(String s,
boolean b)
setUI
public void setUI(MenuUI ui)
- Sets the menu's UI.
- Parameters:
- ui - the new MenuUI
- See Also:
- getUI
updateUI
public void updateUI()
- Gets a new UI object from the default UIFactory.
- Overrides:
- updateUI in class JMenuItem
getUIClassID
public String getUIClassID()
- Returns:
- "MenuUI"
- Overrides:
- getUIClassID in class JMenuItem
- See Also:
- getUIClassID, getUI
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
isSelected
public boolean isSelected()
- Returns the state of the button.
- Overrides:
- isSelected in class AbstractButton
setSelected
public void setSelected(boolean b)
- Sets the state of the button.
- Overrides:
- setSelected in class AbstractButton
isPopupMenuVisible
public boolean isPopupMenuVisible()
setPopupMenuVisible
public void setPopupMenuVisible(boolean b)
getDelay
public int getDelay()
- Returns the suggested delay before the menu's PopupMenu is popped up or down.
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.
setMenuLocation
public void setMenuLocation(int x,
int y)
add
public JMenuItem add(JMenuItem menuItem)
add
public Component add(Component c)
- Adds the specified component to the end of this container.
- Overrides:
- add in class Container
add
public void add(String s)
add
public JMenuItem add(Action a)
addSeparator
public void addSeparator()
insert
public void insert(String s,
int pos)
insert
public JMenuItem insert(JMenuItem mi,
int pos)
insert
public JMenuItem insert(Action a,
int pos)
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.
getItem
public JMenuItem getItem(int pos)
getItemCount
public int getItemCount()
isTearOff
public boolean isTearOff()
remove
public void remove(JMenuItem item)
- Removes the specified menu item from this menu.
- Parameters:
- item - the item to be removed from the menu
remove
public void remove(Action a)
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
removeAll
public void removeAll()
- Removes all the components from this container.
- Overrides:
- removeAll in class Container
getMenuComponentCount
public int getMenuComponentCount()
getMenuComponent
public Component getMenuComponent(int n)
getMenuComponents
public Component[] getMenuComponents()
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
isTopLevelMenu
public boolean isTopLevelMenu()
isMenuComponent
public boolean isMenuComponent(Component c)
- Returns true if the component c exists in the submenu hierarchy.
- Parameters:
- c - the component to be tested
getPopupMenu
public JPopupMenu getPopupMenu()
addMenuListener
public void addMenuListener(MenuListener l)
removeMenuListener
public void removeMenuListener(MenuListener l)
fireMenuSelected
protected void fireMenuSelected()
fireMenuDeselected
protected void fireMenuDeselected()
createWinListener
protected JMenu.WinListener createWinListener(JPopupMenu p)
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
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
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