This content has been marked as final. Show 6 replies
Use your action event getSource() method/
I know that I can use getSource() method to identify action event... but how can I identify the main panel it belongs to?
what's wrong with getSource().getParent() ? (apart from the missing type cast, obviously ;-)
user1202074 wrote:<tt>JPanel</tt>s can't have <tt>ActionListeners</tt>. What class of GUI component are you really talking about?
I have ‘n’ numbers of JPanel. And each panel contains certain number of sub-panels. Those sub-panels have actionlisteners.
Note that ‘n’ is unknown and main panels will be created dynamically. Now, if I attach actionListener with all of those sub_panels,
when I said sub-panels, I meant Jtextfield, Jcombobox.