Package org.xhtmlrenderer.swing
Class MouseTracker
java.lang.Object
java.awt.event.MouseAdapter
javax.swing.event.MouseInputAdapter
org.xhtmlrenderer.swing.MouseTracker
- All Implemented Interfaces:
MouseListener
,MouseMotionListener
,MouseWheelListener
,EventListener
,MouseInputListener
A MouseTracker is used to delegate mouse events to the
FSMouseListener
instances
associated with a BasicPanel
. The tracker will start receiving events as soon
as the first listener is added (via addListener(FSMouseListener)
and will stop receiving events as soon
as the last listener is removed via removeListener(FSMouseListener)
. This binding is handled automatically
via the add and remove methods and the tracker will remain active as long as the tracker has at least one listener.
The MouseTracker is also responsible for using MouseEvent coordinates to located the Box on which the mouse is
acting.-
Constructor Summary
ConstructorsConstructorDescriptionMouseTracker
(BasicPanel panel) Instantiates a MouseTracker to listen to mouse events for the given panel. -
Method Summary
Modifier and TypeMethodDescriptionvoid
Adds a listener to receive callbacks on mouse events.Returns a (new) list of all listeners currently tracked for receiving events.void
void
void
void
void
void
void
Removes the given listener, after which it will no longer receive callbacks on mouse events.void
reset()
Utility method; callsFSMouseListener.reset()
for all listeners currently being tracked.Methods inherited from class java.awt.event.MouseAdapter
mouseClicked, mouseWheelMoved
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface java.awt.event.MouseListener
mouseClicked
-
Constructor Details
-
MouseTracker
Instantiates a MouseTracker to listen to mouse events for the given panel.- Parameters:
panel
- the panel for which mouse events should be delegated.
-
-
Method Details
-
addListener
Adds a listener to receive callbacks on mouse events.- Parameters:
l
- the listener
-
removeListener
Removes the given listener, after which it will no longer receive callbacks on mouse events.- Parameters:
l
- the listener to remove
-
getListeners
Returns a (new) list of all listeners currently tracked for receiving events.- Returns:
- a (new) list of all listeners currently tracked for receiving events.
-
mouseEntered
- Specified by:
mouseEntered
in interfaceMouseListener
- Overrides:
mouseEntered
in classMouseAdapter
-
mouseExited
- Specified by:
mouseExited
in interfaceMouseListener
- Overrides:
mouseExited
in classMouseAdapter
-
mouseMoved
- Specified by:
mouseMoved
in interfaceMouseMotionListener
- Overrides:
mouseMoved
in classMouseAdapter
-
mouseReleased
- Specified by:
mouseReleased
in interfaceMouseListener
- Overrides:
mouseReleased
in classMouseAdapter
-
mousePressed
- Specified by:
mousePressed
in interfaceMouseListener
- Overrides:
mousePressed
in classMouseAdapter
-
mouseDragged
- Specified by:
mouseDragged
in interfaceMouseMotionListener
- Overrides:
mouseDragged
in classMouseAdapter
-
reset
public void reset()Utility method; callsFSMouseListener.reset()
for all listeners currently being tracked.
-