public class PopupMenuLauncher extends MouseAdapter
| Modifier and Type | Field and Description |
|---|---|
private boolean |
checkEnabled |
protected JPopupMenu |
menu |
| Constructor and Description |
|---|
PopupMenuLauncher()
Creates a new
PopupMenuLauncher with no defined menu. |
PopupMenuLauncher(JPopupMenu menu)
Creates a new
PopupMenuLauncher with the given menu. |
PopupMenuLauncher(JPopupMenu menu,
boolean checkEnabled)
Creates a new
PopupMenuLauncher with the given menu. |
| Modifier and Type | Method and Description |
|---|---|
protected void |
checkFocusAndShowMenu(Component component,
MouseEvent evt) |
protected int |
checkListSelection(JList<?> list,
Point p) |
protected boolean |
checkSelection(Component component,
Point p) |
protected int |
checkTableSelection(JTable table,
Point p) |
protected TreePath |
checkTreeSelection(JTree tree,
Point p) |
JPopupMenu |
getMenu() |
protected static boolean |
isDoubleClick(MouseEvent e) |
void |
launch(MouseEvent evt)
Launches the popup menu according to the given mouse event.
|
void |
mousePressed(MouseEvent e) |
void |
mouseReleased(MouseEvent e) |
private void |
processEvent(MouseEvent e) |
protected void |
showMenu(MouseEvent evt) |
mouseClicked, mouseDragged, mouseEntered, mouseExited, mouseMoved, mouseWheelMovedprotected JPopupMenu menu
private final boolean checkEnabled
public PopupMenuLauncher()
PopupMenuLauncher with no defined menu.
It is then needed to override the launch(java.awt.event.MouseEvent) method.launch(MouseEvent)public PopupMenuLauncher(JPopupMenu menu)
PopupMenuLauncher with the given menu.menu - The popup menu to displaypublic PopupMenuLauncher(JPopupMenu menu, boolean checkEnabled)
PopupMenuLauncher with the given menu.menu - The popup menu to displaycheckEnabled - if true, the popup menu will only be displayed if the component triggering the mouse event is enabledpublic void mousePressed(MouseEvent e)
mousePressed in interface MouseListenermousePressed in class MouseAdapterpublic void mouseReleased(MouseEvent e)
mouseReleased in interface MouseListenermouseReleased in class MouseAdapterprivate void processEvent(MouseEvent e)
public void launch(MouseEvent evt)
evt - A mouse eventprotected boolean checkSelection(Component component, Point p)
protected void checkFocusAndShowMenu(Component component, MouseEvent evt)
protected void showMenu(MouseEvent evt)
protected int checkListSelection(JList<?> list, Point p)
protected int checkTableSelection(JTable table, Point p)
protected TreePath checkTreeSelection(JTree tree, Point p)
protected static boolean isDoubleClick(MouseEvent e)
public final JPopupMenu getMenu()
null otherwise.