public class MouseTracker
extends javax.swing.event.MouseInputAdapter
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 and Description |
|---|
MouseTracker(BasicPanel panel)
Instantiates a MouseTracker to listen to mouse events for the given panel.
|
| Modifier and Type | Method and Description |
|---|---|
void |
addListener(FSMouseListener l)
Adds a listener to receive callbacks on mouse events.
|
java.util.List |
getListeners()
Returns a (new) list of all listeners currently tracked for receiving events.
|
void |
mouseDragged(java.awt.event.MouseEvent e) |
void |
mouseEntered(java.awt.event.MouseEvent e) |
void |
mouseExited(java.awt.event.MouseEvent e) |
void |
mouseMoved(java.awt.event.MouseEvent e) |
void |
mousePressed(java.awt.event.MouseEvent e) |
void |
mouseReleased(java.awt.event.MouseEvent e) |
void |
removeListener(FSMouseListener l)
Removes the given listener, after which it will no longer receive callbacks on mouse events.
|
void |
reset()
Utility method; calls
FSMouseListener.reset() for all listeners currently being tracked. |
public MouseTracker(BasicPanel panel)
panel - the panel for which mouse events should be delegated.public void addListener(FSMouseListener l)
l - the listenerpublic void removeListener(FSMouseListener l)
l - the listener to removepublic java.util.List getListeners()
public void mouseEntered(java.awt.event.MouseEvent e)
mouseEntered in interface java.awt.event.MouseListenermouseEntered in class java.awt.event.MouseAdapterpublic void mouseExited(java.awt.event.MouseEvent e)
mouseExited in interface java.awt.event.MouseListenermouseExited in class java.awt.event.MouseAdapterpublic void mouseMoved(java.awt.event.MouseEvent e)
mouseMoved in interface java.awt.event.MouseMotionListenermouseMoved in class java.awt.event.MouseAdapterpublic void mouseReleased(java.awt.event.MouseEvent e)
mouseReleased in interface java.awt.event.MouseListenermouseReleased in class java.awt.event.MouseAdapterpublic void mousePressed(java.awt.event.MouseEvent e)
mousePressed in interface java.awt.event.MouseListenermousePressed in class java.awt.event.MouseAdapterpublic void mouseDragged(java.awt.event.MouseEvent e)
mouseDragged in interface java.awt.event.MouseMotionListenermouseDragged in class java.awt.event.MouseAdapterpublic void reset()
FSMouseListener.reset() for all listeners currently being tracked.Copyright © 2014. All Rights Reserved.