public class PSwingEventHandler extends Object implements PInputEventListener
Constructor and Description |
---|
PSwingEventHandler(PSwingCanvas canvas)
Constructs a new PSwingEventHandler for the given canvas.
|
PSwingEventHandler(PSwingCanvas canvas,
PNode listenNode)
Constructs a new PSwingEventHandler for the given canvas, and a node that
will receive the mouse events.
|
Modifier and Type | Method and Description |
---|---|
(package private) void |
dispatchEvent(PSwingEvent pSwingMouseEvent,
PInputEvent aEvent)
Determines if any Swing components in Piccolo2D should receive the given
MouseEvent and forwards the event to that component.
|
boolean |
isActive()
Returns if this event handler is active.
|
void |
processEvent(PInputEvent aEvent,
int type)
Process a Piccolo2D event and (if active) dispatch the corresponding
Swing event.
|
(package private) void |
setActive(boolean active)
Sets whether this event handler can fire events.
|
public PSwingEventHandler(PSwingCanvas canvas, PNode listenNode)
canvas
- the canvas associated with this PSwingEventHandler.listenNode
- the node the mouse listeners will be attached to.public PSwingEventHandler(PSwingCanvas canvas)
canvas
- to associate this event handler tovoid setActive(boolean active)
active
- true if this event handler can fire eventspublic boolean isActive()
void dispatchEvent(PSwingEvent pSwingMouseEvent, PInputEvent aEvent)
pSwingMouseEvent
- event being dispatchedaEvent
- Piccolo2D event translation of the pSwingMouseEventpublic void processEvent(PInputEvent aEvent, int type)
processEvent
in interface PInputEventListener
aEvent
- Piccolo2D event being tested for dispatch to swingtype
- is not used in this methodCopyright © 1995-2012 Piccolo2D. All Rights Reserved.