• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Bear Bibeault
  • Junilu Lacar
Sheriffs:
  • Jeanne Boyarsky
  • Tim Cooke
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • salvin francis
  • Frits Walraven
Bartenders:
  • Scott Selikoff
  • Piet Souris
  • Carey Brown

Cannot add actionListener to Button ?!?

 
Ranch Hand
Posts: 277
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 :

 
Ranch Hand
Posts: 87
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 277
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 87
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
    Bookmark Topic Watch Topic
  • New Topic