public class MouseTracker extends 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.| 构造器和说明 |
|---|
MouseTracker(BasicPanel panel)
Instantiates a MouseTracker to listen to mouse events for the given panel.
|
| 限定符和类型 | 方法和说明 |
|---|---|
void |
addListener(FSMouseListener l)
Adds a listener to receive callbacks on mouse events.
|
List |
getListeners()
Returns a (new) list of all listeners currently tracked for receiving events.
|
void |
mouseDragged(MouseEvent e) |
void |
mouseEntered(MouseEvent e) |
void |
mouseExited(MouseEvent e) |
void |
mouseMoved(MouseEvent e) |
void |
mousePressed(MouseEvent e) |
void |
mouseReleased(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. |
mouseClicked, mouseWheelMovedclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitmouseClickedpublic 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 List getListeners()
public void mouseEntered(MouseEvent e)
mouseEntered 在接口中 MouseListenermouseEntered 在类中 MouseAdapterpublic void mouseExited(MouseEvent e)
mouseExited 在接口中 MouseListenermouseExited 在类中 MouseAdapterpublic void mouseMoved(MouseEvent e)
mouseMoved 在接口中 MouseMotionListenermouseMoved 在类中 MouseAdapterpublic void mouseReleased(MouseEvent e)
mouseReleased 在接口中 MouseListenermouseReleased 在类中 MouseAdapterpublic void mousePressed(MouseEvent e)
mousePressed 在接口中 MouseListenermousePressed 在类中 MouseAdapterpublic void mouseDragged(MouseEvent e)
mouseDragged 在接口中 MouseMotionListenermouseDragged 在类中 MouseAdapterpublic void reset()
FSMouseListener.reset() for all listeners currently being tracked.Copyright © 2019. All Rights Reserved.