Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

inner class

 
vivi santa
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I've got an inner class question.
I am working on a GUI user interface using AWT with some buttons and textfield. When I do some action performed in class c or class d, how can I invoked x and change its value?
class A extends class B {
Label x
A(){
....
}
class C extends Panel implements ActionListener {
.....
.....
}
class D extends Panel implements ActionListener {
.....
.....
public void actionPerformed{

(access x in here)
}
}

}
Thanks in advance



 
vineetsab
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
class member variables can be accessed inside inner classes. x = new Label() should work in classes c and d
 
Jane Griscti
Ranch Hand
Posts: 3141
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi vineetsab,
Please read the JavaRanch Name Policy and re-register using a name that complies with the rules.
Thanks for your cooperation.
------------------
Jane Griscti
Sun Certified Programmer for the Java� 2 Platform
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic