Application Listener for all the events of all the components

Hi!

I'm developing a relative complex application and I'm lost with the listeners.

I don't know how to manage all the GUI events from a class.

For example, I would like to handle the menu Actionevents, and other events related to a Jtree that is into a JPane, or the Icon ToolBar. I know how to handle them separatedly but that is not the purpose.

So, my question is: How can I know from a single main class which event has been fired and do then the core functionality of my application?

Please, let me know how can I resolve my design problem.

Thanks

[598 byte] By [Blueheada] at [2007-11-27 8:58:33]
# 1

You can simply write a unique class as an ActionListener and in its actionPerformed method you do the following:

Object source = e.getSource(); // e is our event

if (source == component1) {

..

} else if (source == component2) {

..

Hope this helps

marco87otka at 2007-7-12 21:24:47 > top of Java-index,Desktop,Core GUI APIs...
# 2
> Please, let me know how can I resolve my design problem.Your design problem is trying to put all listeners into a single class.
camickra at 2007-7-12 21:24:47 > top of Java-index,Desktop,Core GUI APIs...