When developing java guis (e.g. swing) in eclipse, is there a built-in feature (or plugin) that allows one to monitor all the events that are fired?
Asked
Active
Viewed 856 times
7
-
From a *coding perspective*, [EventQueue](http://download.oracle.com/javase/6/docs/api/java/awt/EventQueue.html) was the closest I could find with an [example here](http://tips4java.wordpress.com/2009/09/06/global-event-dispatching/) (See Howard's answer though). – May 30 '11 at 17:08
-
See also this [answer](http://stackoverflow.com/questions/3158254/how-to-replace-the-awt-eventqueue-with-own-implementation/3158409#3158409) that shows how to instrument the event queue. – trashgod May 30 '11 at 22:10
2 Answers
3
You can also write an AWTEventListener
on your own. Just add the following lines to your program.
Toolkit.getDefaultToolkit().addAWTEventListener(new AWTEventListener() {
public void eventDispatched(AWTEvent event) {
System.out.println(event);
}
}, -1);
Replace the output with anything you like. You can also listen to particular events only by changing -1
to some constants from AWTEvent
.

Howard
- 38,639
- 9
- 64
- 83
1
There is something in eclipse, im not sure if this is exactly what your looking for. its called a "Watch" it watch for anything that happens with that particular variable.

RMT
- 7,040
- 4
- 25
- 37