All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class com.sun.java.swing.JMenu

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

public class JMenu
extends JMenuItem
An implementation of a Menu


Variable Index

 o menuChangeListener
The button's model listeners.
 o menuEvent
Only one MenuEvent is needed per menu instance since the event's only state is the source property.
 o menuListenerList
The lists of client listeners.
 o popupListener
 o ui

Constructor Index

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

Method Index

 o add(Action)
 o add(Component)
 o add(JMenuItem)
 o add(String)
 o addMenuListener(MenuListener)
 o addSeparator()
 o createMenuChangeListener()
 o createWinListener(JPopupMenu)
 o getComponent(int)
 o getComponentAt(int, int)
 o getComponentCount()
 o getComponents()
 o getItem(int)
 o getItemCount()
 o getPopupMenu()
 o getTranslatedPoint(int, int, Component, Component)
Returns the given point in the from components coordinate space translated into the to components coordinate space.
 o insert(Action, int)
 o insert(JMenuItem, int)
 o insert(String, int)
 o insertSeparator(int)
 o isLabelShown()
 o isPopupMenuVisible()
 o isSelected()
Returns the state of the button.
 o isSubComponent(Component)
Returns true if the component c exists in the submenu hierarchy.
 o isTearOff()
 o isTopLevelMenu()
 o paramString()
 o remove(Action)
 o remove(int)
 o remove(JMenuItem)
 o removeAll()
 o removeMenuListener(MenuListener)
 o setLabelShown(boolean)
 o setLocation(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 translateToPopupMenu(int, int)
Returns a point in the coordinate space of this menu's popupmenu which corresponds to the point (x,y) in the menu's coordinate space.
 o translateToPopupMenu(Point)
Returns a point in the coordinate space of this menu's popupmenu which corresponds to the point p in the menu's coordinate space.
 o updateUI()
Gets a new UI object from the default UIFactory.

Variables

 o ui
 protected MenuUI ui
 o popupListener
 protected JMenu. WinListener popupListener
 o menuChangeListener
 protected ChangeListener menuChangeListener
The button's model listeners.

 o menuListenerList
 protected MenuListener menuListenerList
The lists of client listeners.

 o menuEvent
 protected MenuEvent menuEvent
Only one MenuEvent is needed per menu instance since the event's only state is the source property. The source of events generated is always "this".

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 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 setLocation
 public void setLocation(int x,
                         int y)
Overrides:
setLocation in class Component
 o add
 public JMenuItem add(JMenuItem menuItem)
 o add
 public Component add(Component c)
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 void insert(Action a,
                    int pos)
 o insertSeparator
 public JMenuItem insertSeparator(int pos)
 o getItem
 public JMenuItem getItem(int pos)
 o getItemCount
 public int getItemCount()
 o isTearOff
 public boolean isTearOff()
 o remove
 public void remove(JMenuItem mi)
 o remove
 public void remove(Action a)
 o remove
 public void remove(int pos)
Overrides:
remove in class Container
 o removeAll
 public void removeAll()
Overrides:
removeAll in class Container
 o getComponentCount
 public int getComponentCount()
Overrides:
getComponentCount in class Container
 o getComponent
 public Component getComponent(int n)
Overrides:
getComponent in class Container
 o getComponents
 public Component[] getComponents()
Overrides:
getComponents in class Container
 o paramString
 protected String paramString()
Overrides:
paramString in class Container
 o setLabelShown
 public void setLabelShown(boolean b)
 o isLabelShown
 public boolean isLabelShown()
 o isTopLevelMenu
 public boolean isTopLevelMenu()
 o getComponentAt
 public Component getComponentAt(int x,
                                 int y)
Overrides:
getComponentAt in class Container
 o getTranslatedPoint
 public Point getTranslatedPoint(int x,
                                 int y,
                                 Component from,
                                 Component to)
Returns the given point in the from components coordinate space translated into the to components coordinate space. The from component is expected to be a menu-parent of the to component.

 o isSubComponent
 public boolean isSubComponent(Component c)
Returns true if the component c exists in the submenu hierarchy.

Parameters:
c - the component to be tested
 o translateToPopupMenu
 public Point translateToPopupMenu(Point p)
Returns a point in the coordinate space of this menu's popupmenu which corresponds to the point p in the menu's coordinate space.

Parameters:
p - the point to be translated
 o translateToPopupMenu
 public Point translateToPopupMenu(int x,
                                   int y)
Returns a point in the coordinate space of this menu's popupmenu which corresponds to the point (x,y) in the menu's coordinate space.

Parameters:
x - the x coordinate of the point to be translated
y - the y coordinate of the point to be translated
 o getPopupMenu
 public JPopupMenu getPopupMenu()
 o addMenuListener
 public void addMenuListener(MenuListener l)
 o removeMenuListener
 public void removeMenuListener(MenuListener l)
 o createMenuChangeListener
 protected ChangeListener createMenuChangeListener()
 o createWinListener
 protected JMenu. WinListener createWinListener(JPopupMenu p)

All Packages  Class Hierarchy  This Package  Previous  Next  Index