Class PopupMenuLauncher
java.lang.Object
java.awt.event.MouseAdapter
org.openstreetmap.josm.gui.widgets.PopupMenuLauncher
- All Implemented Interfaces:
MouseListener,MouseMotionListener,MouseWheelListener,EventListener
- Direct Known Subclasses:
ChangesetCacheManager.MouseEventHandler,CommandStackDialog.MouseEventHandler,ConflictDialog.MouseEventHandler,LayerListDialog.PopupMenuHandler,MapPaintDialog.PopupMenuHandler,NodeListViewer.InternalPopupMenuLauncher,PropertiesDialog.BlankSpaceMenuLauncher,RelationListDialog.MouseEventHandler,RelationMemberListViewer.InternalPopupMenuLauncher,SelectionListDialog.MouseEventHandler,ToggleDialog.TitleBar.MouseEventHandler,ValidatorDialog.MouseEventHandler,VersionTable.MouseListener
Utility class that helps to display popup menus on mouse events.
- Since:
- 2688
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionCreates a newPopupMenuLauncherwith no defined menu.PopupMenuLauncher(JPopupMenu menu) Creates a newPopupMenuLauncherwith the given menu.PopupMenuLauncher(JPopupMenu menu, boolean checkEnabled) Creates a newPopupMenuLauncherwith the given menu. -
Method Summary
Modifier and TypeMethodDescriptionprotected voidcheckFocusAndShowMenu(Component component, MouseEvent evt) protected intcheckListSelection(JList<?> list, Point p) protected booleancheckSelection(Component component, Point p) protected intcheckTableSelection(JTable table, Point p) protected TreePathcheckTreeSelection(JTree tree, Point p) voidEmpties the internal undo manager, if any.final JPopupMenugetMenu()Returns the popup menu.protected static booleanvoidlaunch(MouseEvent evt) Launches the popup menu according to the given mouse event.voidvoidprivate voidprotected voidshowMenu(MouseEvent evt) Methods inherited from class java.awt.event.MouseAdapter
mouseClicked, mouseDragged, mouseEntered, mouseExited, mouseMoved, mouseWheelMoved
-
Field Details
-
checkEnabled
-
Constructor Details
-
PopupMenuLauncher
public PopupMenuLauncher()Creates a newPopupMenuLauncherwith no defined menu. It is then needed to override thelaunch(java.awt.event.MouseEvent)method.- See Also:
-
PopupMenuLauncher
Creates a newPopupMenuLauncherwith the given menu.- Parameters:
menu- The popup menu to display
-
PopupMenuLauncher
Creates a newPopupMenuLauncherwith the given menu.- Parameters:
menu- The popup menu to displaycheckEnabled- iftrue, the popup menu will only be displayed if the component triggering the mouse event is enabled- Since:
- 5886
-
-
Method Details
-
mousePressed
- Specified by:
mousePressedin interfaceMouseListener- Overrides:
mousePressedin classMouseAdapter
-
mouseReleased
- Specified by:
mouseReleasedin interfaceMouseListener- Overrides:
mouseReleasedin classMouseAdapter
-
processEvent
-
launch
Launches the popup menu according to the given mouse event. This method needs to be overridden if the default constructor has been called.- Parameters:
evt- A mouse event
-
checkSelection
-
checkFocusAndShowMenu
-
showMenu
-
checkListSelection
-
checkTableSelection
-
checkTreeSelection
-
isDoubleClick
-
getMenu
Returns the popup menu.- Returns:
- the popup menu if defined,
nullotherwise. - Since:
- 5884
-
discardAllUndoableEdits
Empties the internal undo manager, if any.- Since:
- 14977
-