Platinum Partner

Use AWTEventListener For Debugging Events

For debugging to help find where events are coming from, one can use AWTEventListeners to listen to all events that are dispatched.  The following code shows an example that will print out the source component for all key events that are processed by AWT (and consequently Swing):


        Toolkit.getDefaultToolkit().addAWTEventListener(new AWTEventListener() {
 
            public void eventDispatched(AWTEvent event) {
                System.out.println(event.getSource());
 
            }
 
        }, AWTEvent.KEY_EVENT_MASK);
{{ tag }}, {{tag}},

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}
{{ parent.authors[0].realName || parent.author}}

{{ parent.authors[0].tagline || parent.tagline }}

{{ parent.views }} ViewsClicks
Tweet

{{parent.nComments}}