In Java Swing I can register a listener to a certain gui event as follows
guiElement.addMouseListener(myListener);
but what if I want to automatically register to all the mouse events in my GUI application?
should I register myListener to each element?
In other words what I am looking for is something like
myListener.registerToEventType(MouseEvent.class)
Any idea?
Thank you
but what if I want to automatically register to all the mouse events in my GUI application?
@see AWTEventListener, there are Mouse & Key Events
should I register myListener to each element?
yes is better than to redirect, consume or using SwingUtilities for apply MouseEvents to the derised JComponets, notice code could be longer than annonymous listener added to each of JComponents separatelly
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With