|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object net.lucidviews.util.gui.event.MouseActivityNotifier
public class MouseActivityNotifier
Listens for mouse events and sends notification when the user is using or has
stopped using the mouse.
For each mouse event, if the notifier is not already in an active state, an
active event is published. A thread is then started which causes a delay
before sending the dormant event. If another mouse event received within the
delayed time period slot then another thread is started to re-start the
delay.
Nested Class Summary | |
---|---|
static class |
MouseActivityNotifier.InactiveNotificationThread
|
Field Summary | |
---|---|
protected long |
_delay
|
protected MouseActivityNotifier.InactiveNotificationThread |
_inactiveNotificationThread
|
protected Collection |
_listeners
|
Constructor Summary | |
---|---|
MouseActivityNotifier(long delay)
Create a mouse activity notifier that notifies all of its listeners when mouse activity begins and when no activity has been received for the given time period. |
Method Summary | |
---|---|
void |
addIsolatedKeyEventListener(MouseActivityListener listener)
Register a listener that wants to be notified of mouse activity. |
void |
addSource(Component component)
Tells this activity notifier to listen to the specified component for mouse events. |
void |
mouseDragged(MouseEvent e)
|
void |
mouseMoved(MouseEvent e)
|
protected void |
notifyMouseNowActive(MouseEvent mouseEvent)
Notify all listeners that the mouse is now active. |
protected void |
notifyMouseNowInactive()
Notify all listeners that the mouse is now inactive. |
void |
removeIsolatedKeyEventListener(MouseActivityListener listener)
Un-register a listener that does not want to be notified of mouse activity. |
void |
removeSource(Component component)
Tells this activity notifier to stop listening to the specified component for mouse events. |
protected void |
startInactiveNotificationThread()
Start a new thread that will call the inactive method after the specified delay. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected Collection _listeners
protected long _delay
protected MouseActivityNotifier.InactiveNotificationThread _inactiveNotificationThread
Constructor Detail |
---|
public MouseActivityNotifier(long delay)
delay
- the number of milli-seconds after which the mouse is
considered inactiveMethod Detail |
---|
public void mouseDragged(MouseEvent e)
mouseDragged
in interface MouseMotionListener
public void mouseMoved(MouseEvent e)
mouseMoved
in interface MouseMotionListener
public void addIsolatedKeyEventListener(MouseActivityListener listener)
listener
- object that is to receive notificationspublic void removeIsolatedKeyEventListener(MouseActivityListener listener)
listener
- object that is no longer to receive notificationsprotected void notifyMouseNowActive(MouseEvent mouseEvent)
mouseEvent
- the mouse event that was receivedprotected void notifyMouseNowInactive()
public void addSource(Component component)
component
- the component from which mouse events indicate mouse
activitypublic void removeSource(Component component)
component
- the component from which mouse events no longer indicate
mouse activityprotected void startInactiveNotificationThread()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |