| Author |
Cannot add actionListener to Button ?!?
|
achana chan
Ranch Hand
Joined: Jul 29, 2002
Posts: 277
|
|
Hi, I made a few minor modifications to a erstwhile working applet and get the following error message : ... cannot resolve symbol symbol : variable search location : class java.awt.Panel PanelCliInfo.search.ActionListener(this); ... The complete applet is big, so here is the gist of it :
|
humanum errare est.
|
 |
basha khan
Ranch Hand
Joined: Jan 18, 2002
Posts: 87
|
|
this is an innerclass problom .. change PanelCliInfo.search.addActionListener(this); // this DOES NOT WORK! to demoApplet.this.PanelCliInfo.search.addActionListener(this); this will work basha
|
 |
achana chan
Ranch Hand
Joined: Jul 29, 2002
Posts: 277
|
|
Hi. Thanks for that, it compiles fine again. However, when I try to run it after modifying and recompiling, I get this unusual runtime error on the java console : When I re-instate the original applet without the inner panel p2, it works fine again and does not throw the NullPointer Exception ! The error message is too cryptic for me to begin debugging it. Nice Chrissy treat from JAVA. Can you please explain the theory behind the "inner class" to me ? It would be nice to understand wy it compiles. THX Merry Christmas .  [ December 25, 2002: Message edited by: achana chan ]
|
 |
basha khan
Ranch Hand
Joined: Jan 18, 2002
Posts: 87
|
|
u made a varible for ClientInfo twice and assigned object to local variable.that's the problm.. u can resolve like this, change Panel PanelCliInfo = new ClientInfo();//in init() method to PanelCliInfo = new ClientInfo(); that's all basha
|
 |
 |
|
|
subject: Cannot add actionListener to Button ?!?
|
|
|