This week's book giveaway is in the OCMJEA forum.
We're giving away four copies of OCM Java EE 6 Enterprise Architect Exam Guide and have Paul Allen & Joseph Bambara on-line!
See this thread for details.
The moose likes Beginning Java and the fly likes addActionListener problem Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCM Java EE 6 Enterprise Architect Exam Guide this week in the OCMJEA forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "addActionListener problem" Watch "addActionListener problem" New topic
Author

addActionListener problem

Jesse Crockett
Ranch Hand

Joined: Feb 03, 2005
Posts: 129
what's the problem with this code? I get errors that the buttons aren't found inside the actionPerformed method...

Christophe Verré
Sheriff

Joined: Nov 24, 2005
Posts: 14687
    
  16

Declare the buttons as private class members, not as local variables in the constructor.


[My Blog]
All roads lead to JavaRanch
Jesse Crockett
Ranch Hand

Joined: Feb 03, 2005
Posts: 129
thanks! :-)
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: addActionListener problem