how to handle child events in parent when both having separately implemented listeners?
Problem 'm facing: i've an Applet and i created two classes(each extends AWT Panel and implements ActionListener) as "Pan1" and "Pan2". Onloading of the applet, "Pan1" is instantiated and made visible after adding into applet. "Pan1" contains a button. Actually, when i click on this button "Pan2" should be created and made visible which contains some other controls.
here, how'll i listen for the events of "Pan1" in applet and to load "Pan2" into applet itself. Inturn both those panels implements listeners to act internally.
hope 'm clear. if possible, can come out with sample code. Or if there any other approach. Thanks.
posted 11 years ago
seems several options are possible:
panel1 "show panel2" button . implement actionlistener as anonymous inner class . implement special actionListener class . associate an AbstractAction-derived class . etc
parent can also be the listener for this component...
possible panel2 display strategy . if layout/screen real estate is fixed, you could instantiate an invisible panel2, and have the button trigger _setVisible