GNU Classpath (0.95) | |
Prev Class | Next Class | Frames | No Frames |
Summary: Nested | Field | Method | Constr | Detail: Nested | Field | Method | Constr |
java.lang.Object
java.awt.Component
java.awt.Container
javax.swing.JComponent
javax.swing.JPopupMenu
Nested Class Summary | |
protected class | |
static 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 , Component.BltBufferStrategy , Component.FlipBufferStrategy |
Field Summary | |
protected SingleSelectionModel |
|
Fields inherited from class javax.swing.JComponent | |
TOOL_TIP_TEXT_KEY , UNDEFINED_CONDITION , WHEN_ANCESTOR_OF_FOCUSED_COMPONENT , WHEN_FOCUSED , WHEN_IN_FOCUSED_WINDOW , accessibleContext , listenerList , ui |
Fields inherited from class java.awt.Component | |
BOTTOM_ALIGNMENT , CENTER_ALIGNMENT , LEFT_ALIGNMENT , RIGHT_ALIGNMENT , TOP_ALIGNMENT |
Fields inherited from interface java.awt.image.ImageObserver | |
ABORT , ALLBITS , ERROR , FRAMEBITS , HEIGHT , PROPERTIES , SOMEBITS , WIDTH |
Constructor Summary | |
| |
|
Method Summary | |
JMenuItem | |
JMenuItem | |
JMenuItem | |
void |
|
void |
|
void |
|
protected PropertyChangeListener |
|
protected JMenuItem |
|
protected void |
|
protected void |
|
protected void |
|
AccessibleContext |
|
Component |
|
Component |
|
int |
|
static boolean |
|
Component |
|
String |
|
Insets |
|
MenuKeyListener[] |
|
PopupMenuListener[] |
|
SingleSelectionModel |
|
MenuElement[] |
|
PopupMenuUI |
|
String |
|
void | |
void | |
boolean |
|
boolean |
|
boolean |
|
boolean |
|
void |
|
void |
|
protected String |
|
void |
|
void |
|
void |
|
void |
|
void |
|
void |
|
static void |
|
void |
|
void | |
void |
|
void |
|
void |
|
void |
|
void |
|
void |
|
void |
|
void |
|
void | |
void |
|
Methods inherited from class java.lang.Object | |
clone , equals , extends Object> getClass , finalize , hashCode , notify , notifyAll , toString , wait , wait , wait |
protected SingleSelectionModel selectionModel
SelectionModel that keeps track of menu selection.
public JPopupMenu(String label)
Creates a new JPopupMenu with specified label
- Parameters:
label
- Label for popup menu.
public JMenuItem add(String text)
Constructs menu item with a specified label and adds it to popup menu
- Parameters:
text
- label for the menu item to be added
- Returns:
- constructed menu item that was added to the popup menu
public JMenuItem add(Action action)
Constructs menu item associated with the specified action and adds it to the popup menu
- Parameters:
action
- Action for the new menu item
- Returns:
- menu item that was added to the menu
public JMenuItem add(JMenuItem item)
Adds given menu item to the popup menu
- Parameters:
item
- menu item to add to the popup menu
- Returns:
- menu item that was added to the popup menu
public void addMenuKeyListener(MenuKeyListener l)
Adds a MenuKeyListener to the popup.
- Parameters:
l
- - the listener to add.
public void addPopupMenuListener(PopupMenuListener listener)
Adds popupMenuListener to listen for PopupMenuEvents fired by the JPopupMenu
- Parameters:
listener
- PopupMenuListener to add to JPopupMenu
protected PropertyChangeListener createActionChangeListener(JMenuItem item)
Creates PropertyChangeListener that listens to PropertyChangeEvents occuring in the Action associated with given menu item in this popup menu.
- Parameters:
item
- MenuItem
- Returns:
- The PropertyChangeListener
protected JMenuItem createActionComponent(Action action)
Creates new menu item associated with a given action.
- Parameters:
action
- Action used to create new menu item
- Returns:
- new created menu item associated with a given action.
protected void firePopupMenuCanceled()
This method calls popupMenuCanceled() of popup menu's PopupMenuListeners. This method is invoked just before popup menu is cancelled. This happens when popup menu is closed without selecting any of its menu items. This usually happens when the top-level window is resized or moved.
protected void firePopupMenuWillBecomeInvisible()
This method calls popupMenuWillBecomeInvisible() of popup menu's PopupMenuListeners. This method is invoked just before popup menu will disappear from the screen
protected void firePopupMenuWillBecomeVisible()
This method calls popupMenuWillBecomeVisible() of popup menu's PopupMenuListeners. This method is invoked just before popup menu will appear on the screen.
public AccessibleContext getAccessibleContext()
DOCUMENT ME!
- Specified by:
- getAccessibleContext in interface Accessible
- Overrides:
- getAccessibleContext in interface JComponent
- Returns:
- DOCUMENT ME!
public Component getComponent()
Method of the MenuElement interface. Returns reference to itself.
- Specified by:
- getComponent in interface MenuElement
- Returns:
- Returns reference to itself
public Component getComponentAtIndex(int index)
Deprecated. Replaced by getComponent(int)
Returns component located at the specified index in the popup menu
- Parameters:
index
- index of the component to return
- Returns:
- component located at the specified index in the popup menu
public int getComponentIndex(Component component)
Returns index of the specified component in the popup menu
- Parameters:
component
- Component to look for
- Returns:
- index of the specified component in the popup menu
public static boolean getDefaultLightWeightPopupEnabled()
Returns flag indicating if newly created JPopupMenu will use heavyweight or lightweight container to display its menu items
- Returns:
- true if JPopupMenu will use lightweight container to display menu items by default, and false otherwise.
public String getLabel()
Returns label for this popup menu
- Returns:
- label for this popup menu
public Insets getMargin()
Returns margin for this popup menu.
- Returns:
- margin for this popup menu.
public MenuKeyListener[] getMenuKeyListeners()
Returns array of getMenuKeyListeners that are listening to JPopupMenu.
- Returns:
- array of getMenuKeyListeners that are listening to JPopupMenu
public PopupMenuListener[] getPopupMenuListeners()
Returns array of PopupMenuListeners that are listening to JPopupMenu
- Returns:
- Array of PopupMenuListeners that are listening to JPopupMenu
public SingleSelectionModel getSelectionModel()
Returns selectionModel used by this popup menu to keep track of the selection.
- Returns:
- popup menu's selection model
public MenuElement[] getSubElements()
Return subcomonents of this popup menu. This method returns only components that implement theMenuElement
interface.
- Specified by:
- getSubElements in interface MenuElement
- Returns:
- array of menu items belonging to this popup menu
public PopupMenuUI getUI()
This method returns the UI used to display the JPopupMenu.
- Returns:
- The UI used to display the JPopupMenu.
public String getUIClassID()
This method returns a name to identify which look and feel class will be the UI delegate for the menuItem.
- Overrides:
- getUIClassID in interface JComponent
- Returns:
- The Look and Feel classID. "PopupMenuUI"
public void insert(Component component, int index)
Insert given component to the popup menu at the specified index
- Parameters:
component
- Component to insertindex
- Index at which to insert given component
public void insert(Action action, int index)
Create menu item associated with the given action and inserts it into the popup menu at the specified index
- Parameters:
action
- Action for the new menu itemindex
- index in the popup menu at which to insert new menu item.
public boolean isBorderPainted()
Checks if this popup menu paints its border.
- Returns:
- true if this popup menu paints its border and false otherwise.
public boolean isLightWeightPopupEnabled()
Returns true if this popup menu will display its menu item in a lightweight container and false otherwise.
- Returns:
- true if this popup menu will display its menu items in a lightweight container and false otherwise.
public boolean isPopupTrigger(MouseEvent event)
Checks if observing mouse event should trigger popup menu to show on the screen.
- Parameters:
event
- MouseEvent to check
- Returns:
- true if the observing mouse event is popup trigger and false otherwise
public boolean isVisible()
Return visibility of the popup menu
- Returns:
- true if popup menu is visible on the screen and false otherwise.
public void menuSelectionChanged(boolean changed)
Method of MenuElement Interface. It is invoked when popupMenu's selection has changed
- Specified by:
- menuSelectionChanged in interface MenuElement
- Parameters:
changed
- true if this popupMenu is part of current menu hierarchy and false otherwise.
public void pack()
This methods sets popup menu's size to its' preferred size. If the popup menu's size is previously set it will be ignored.
protected String paramString()
A string that describes this JPopupMenu. Normally only used for debugging.
- Overrides:
- paramString in interface JComponent
- Returns:
- A string describing this JMenuItem
public void processKeyEvent(KeyEvent event, MenuElement[] path, MenuSelectionManager manager)
Process key events forwarded from MenuSelectionManager. This method doesn't do anything. It is here to conform to the MenuElement interface.
- Specified by:
- processKeyEvent in interface MenuElement
- Parameters:
event
- event forwarded from MenuSelectionManagerpath
- path to the menu element from which event was generatedmanager
- MenuSelectionManager for the current menu hierarchy
public void processMouseEvent(MouseEvent event, MenuElement[] path, MenuSelectionManager manager)
Process mouse events forwarded from MenuSelectionManager. This method doesn't do anything. It is here to conform to the MenuElement interface.
- Specified by:
- processMouseEvent in interface MenuElement
- Parameters:
event
- event forwarded from MenuSelectionManagerpath
- path to the menu element from which event was generatedmanager
- MenuSelectionManager for the current menu hierarchy
public void remove(int index)
Revomes component at the given index from the menu.
- Parameters:
index
- index of the component that will be removed in the menu
public void removeMenuKeyListener(MenuKeyListener l)
Removes a MenuKeyListener from the popup.
- Parameters:
l
- - the listener to remove.
public void removePopupMenuListener(PopupMenuListener listener)
Removes PopupMenuListener from JPopupMenu's list of listeners
- Parameters:
listener
- PopupMenuListener which needs to be removed
public void setBorderPainted(boolean painted)
Sets if the border of the popup menu should be painter or not.
- Parameters:
painted
- true if the border should be painted and false otherwise
public static void setDefaultLightWeightPopupEnabled(boolean enabled)
Sets whether JPopupMenu should use ligthWeight container to display it menu items by default
- Parameters:
enabled
- true if JPopupMenu should use lightweight container for displaying its menu items, and false otherwise.
public void setInvoker(Component component)
Sets popup menu's invoker.
- Parameters:
component
- The new invoker of this popup menu
public void setLabel(String label)
Sets label for this popup menu. This method fires PropertyChangeEvent when the label property is changed. Please note that most of the Look & Feel will ignore this property.
- Parameters:
label
- label for this popup menu
public void setLightWeightPopupEnabled(boolean enabled)
DOCUMENT ME!
- Parameters:
enabled
- DOCUMENT ME!
public void setLocation(int x, int y)
Sets location of the popup menu.
- Overrides:
- setLocation in interface Component
- Parameters:
x
- X coordinate of the popup menu's locationy
- Y coordinate of the popup menu's location
public void setPopupSize(int width, int height)
Sets size of the popup menu
- Parameters:
width
- width for the new sizeheight
- height for the new size
public void setPopupSize(Dimension size)
Sets size of the popup
- Parameters:
size
- Dimensions representing new size of the popup menu
public void setSelected(Component selected)
Selects specified component in this popup menu.
- Parameters:
selected
- component to select
public void setSelectionModel(SingleSelectionModel model)
Sets selection model for this popup menu
- Parameters:
model
- new selection model of this popup menu
public void setUI(PopupMenuUI ui)
Set the "UI" property of the menu item, which is a look and feel class responsible for handling popupMenu's input events and painting it.
- Parameters:
ui
- The new "UI" property
public void setVisible(boolean visible)
Sets visibility property of this popup menu. If the property is set to true then popup menu will be dispayed and popup menu will hide itself if visible property is set to false.
- Overrides:
- setVisible in interface JComponent
- Parameters:
visible
- true if popup menu will become visible and false otherwise.
public void show(Component component, int x, int y)
This method displays JPopupMenu on the screen at the specified location. Note that x and y coordinates given to this method should be expressed in terms of the popup menus' invoker.
- Parameters:
component
- Invoker for this popup menux
- x-coordinate of the popup menu relative to the specified invokery
- y-coordiate of the popup menu relative to the specified invoker
public void updateUI()
This method sets this menuItem's UI to the UIManager's default for the current look and feel.
- Overrides:
- updateUI in interface JComponent
GNU Classpath (0.95) |