You can also write AWTEventListener
yourself. 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 can also listen to certain events only by changing -1
to some constants from AWTEvent
.
Howard
source share