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 locate 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 TypeMethodDescriptionvoidAdds a listener to receive callbacks on mouse events.Returns a (new) list of all listeners currently tracked for receiving events.voidvoidvoidvoidvoidvoidvoidRemoves the given listener, after which it will no longer receive callbacks on mouse events.voidreset()Utility method; callsFSMouseListener.reset()for all listeners currently being tracked.Methods inherited from class java.awt.event.MouseAdapter
mouseClicked, mouseWheelMovedMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods 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:
mouseEnteredin interfaceMouseListener- Overrides:
mouseEnteredin classMouseAdapter
-
mouseExited
- Specified by:
mouseExitedin interfaceMouseListener- Overrides:
mouseExitedin classMouseAdapter
-
mouseMoved
- Specified by:
mouseMovedin interfaceMouseMotionListener- Overrides:
mouseMovedin classMouseAdapter
-
mouseReleased
- Specified by:
mouseReleasedin interfaceMouseListener- Overrides:
mouseReleasedin classMouseAdapter
-
mousePressed
- Specified by:
mousePressedin interfaceMouseListener- Overrides:
mousePressedin classMouseAdapter
-
mouseDragged
- Specified by:
mouseDraggedin interfaceMouseMotionListener- Overrides:
mouseDraggedin classMouseAdapter
-
reset
public void reset()Utility method; callsFSMouseListener.reset()for all listeners currently being tracked.
-