public class SwingMouseHandler extends MouseHandler
Modifier and Type | Class and Description |
---|---|
private static class |
SwingMouseHandler.WorkArea
Container for mouse-related data.
|
Modifier and Type | Field and Description |
---|---|
private java.awt.event.MouseEvent |
delayedMouseExited
Delayed mouseExited event.
|
private Widget<?> |
lastHoveredWidget
The last widget over which the mouse was moved.
|
private static ContextLocal<SwingMouseHandler.WorkArea> |
local
Context-local data for this mouse-handler.
|
private boolean |
pressed
Pressed flag.
|
ews, tc
Constructor and Description |
---|
SwingMouseHandler() |
Modifier and Type | Method and Description |
---|---|
(package private) static void |
deregisterAction(int wid)
Deregister the complex actions for the specified widget ID.
|
private Widget<?> |
findMouseSource(java.awt.event.MouseEvent e)
Find the mouse source on which the specified event will act, based on coordinates.
|
Widget<?> |
getDropCandidate()
Returns the widget that can be considered as candidate for drop operation.
|
void |
mouseClicked(java.awt.event.MouseEvent e)
Notification of a mouse clicked event.
|
void |
mouseDragged(java.awt.event.MouseEvent e)
Notification of a mouse dragged event.
|
void |
mouseEntered(java.awt.event.MouseEvent e)
Notification of a mouse entered event.
|
void |
mouseExited(java.awt.event.MouseEvent e)
Notification of a mouse exited event.
|
void |
mouseMoved(java.awt.event.MouseEvent e)
Notification of a mouse moved event.
|
void |
mousePressed(java.awt.event.MouseEvent e)
Notification of a mouse pressed event.
|
void |
mouseReleased(java.awt.event.MouseEvent e)
Notification of a mouse released event.
|
void |
mouseWheelMoved(java.awt.event.MouseWheelEvent e)
Notification of a mouse wheel event.
|
private boolean |
processAction(java.awt.event.MouseEvent e)
Determine the widget which will react on the specified event and process any actions
associated with it.
|
private boolean |
processAction(Widget<?> widget,
java.awt.event.MouseEvent e)
Process any actions for the given widget and event.
|
(package private) static void |
registerAction(int wid,
MouseWidgetAction action)
Register a complex action for the specified widget ID.
|
applyMouseEvent, canProcessMouse, captureMouseEvents, deregisterTooltipWorker, deregisterWidget, getCachedActions, getWidgetActions, getWidgetListForTooltipWorkers, handleMouseEvent, processWidgetActions, registerWidgetAction, setWindow
private static final ContextLocal<SwingMouseHandler.WorkArea> local
private Widget<?> lastHoveredWidget
private boolean pressed
private java.awt.event.MouseEvent delayedMouseExited
public void mouseClicked(java.awt.event.MouseEvent e)
mouseClicked
in interface java.awt.event.MouseListener
mouseClicked
in class MouseHandler
e
- The mouse event.public void mousePressed(java.awt.event.MouseEvent e)
mousePressed
in interface java.awt.event.MouseListener
mousePressed
in class MouseHandler
e
- The mouse event.public void mouseReleased(java.awt.event.MouseEvent e)
mouseReleased
in interface java.awt.event.MouseListener
mouseReleased
in class MouseHandler
e
- The mouse event.public void mouseEntered(java.awt.event.MouseEvent e)
mouseEntered
in interface java.awt.event.MouseListener
mouseEntered
in class MouseHandler
e
- The mouse event.public void mouseExited(java.awt.event.MouseEvent e)
mouseExited
in interface java.awt.event.MouseListener
mouseExited
in class MouseHandler
e
- The mouse event.public void mouseWheelMoved(java.awt.event.MouseWheelEvent e)
mouseWheelMoved
in interface java.awt.event.MouseWheelListener
mouseWheelMoved
in class MouseHandler
e
- The mouse event.public void mouseDragged(java.awt.event.MouseEvent e)
mouseDragged
in interface java.awt.event.MouseMotionListener
mouseDragged
in class MouseHandler
e
- The mouse event.public void mouseMoved(java.awt.event.MouseEvent e)
If the hovered widget has changed, it will raise MouseEvent.MOUSE_EXITED
and
MouseEvent.MOUSE_ENTERED
events instead of MouseEvent.MOUSE_MOVED
.
mouseMoved
in interface java.awt.event.MouseMotionListener
mouseMoved
in class MouseHandler
e
- The mouse event.public Widget<?> getDropCandidate()
static final void deregisterAction(int wid)
wid
- The widget ID.static final void registerAction(int wid, MouseWidgetAction action)
Use this method (instead of the
MouseHandler.registerWidgetAction(int, MouseWidgetAction)
) to register
actions to Swing GUI-specific action map, i.e. the actions will be ignored
by other drivers.
wid
- The widget ID.action
- The mouse action.private Widget<?> findMouseSource(java.awt.event.MouseEvent e)
e
- The event.TitledWindow.findMouseSource(com.goldencode.p2j.ui.client.event.MouseEvt)
.private boolean processAction(java.awt.event.MouseEvent e)
e
- The mouse event.private boolean processAction(Widget<?> widget, java.awt.event.MouseEvent e)
widget
- The widget. If null
, it will be determined by
findMouseSource(java.awt.event.MouseEvent)
.e
- The mouse event.true
if at least one action was executed