public class PopupManager extends MouseAdapter
Modifier and Type | Field and Description |
---|---|
static String |
POPUPMANAGER_PROPERTY
to make the handling of a JPopupMenu easy, we store ourself in
our popup widget's properties
|
Modifier and Type | Method and Description |
---|---|
void |
addManagedComponent(JComponent pComponent)
Add a component to manage the popup for.
|
JPopupMenu |
getPopup()
Return Swing popup widget.
|
static JComponent |
getPopupTrigger(ActionEvent pEvent)
Small helper method to get the trigger of a popup action.
|
static JPopupMenu |
getRootPopup(ActionEvent pEvent)
Small helper method to get the popup menu of a popup action.
|
int |
getX()
returns the x position of the last mPopup.show();
|
int |
getY()
returns the y position of the last mPopup.show();
|
void |
mousePressed(MouseEvent pEvent) |
void |
mouseReleased(MouseEvent pEvent) |
void |
removeManagedComponent(JComponent pComponent)
Remove a component from our popup management.
|
mouseClicked, mouseDragged, mouseEntered, mouseExited, mouseMoved, mouseWheelMoved
public static final String POPUPMANAGER_PROPERTY
public JPopupMenu getPopup()
public int getX()
public int getY()
public void addManagedComponent(JComponent pComponent)
pComponent
- the component we should managepublic void removeManagedComponent(JComponent pComponent)
pComponent
- the component we should removepublic void mousePressed(MouseEvent pEvent)
mousePressed
in interface MouseListener
mousePressed
in class MouseAdapter
public void mouseReleased(MouseEvent pEvent)
mouseReleased
in interface MouseListener
mouseReleased
in class MouseAdapter
public static JComponent getPopupTrigger(ActionEvent pEvent)
pEvent
- triggered action event (may be null)public static JPopupMenu getRootPopup(ActionEvent pEvent)
pEvent
- triggered action event (may be null)Copyright © 2017 Jürgen Zeller (privat). All rights reserved.