aspose file tools
The moose likes Beginning Java and the fly likes reference problem within inner class Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Java » Beginning Java
Reply Bookmark "reference problem within inner class" Watch "reference problem within inner class" New topic
Author

reference problem within inner class

miguel lisboa
Ranch Hand

Joined: Feb 08, 2004
Posts: 1281
inside my class Gui i've an anonymous inner class; from inside this inner class i need a reference to the outer class

how i did it: inside outer constructor,

then, inside inner, i used 'gui';

isnt there a better way?

TiA


java amateur
Ariel Ortiz
Ranch Hand

Joined: May 14, 2004
Posts: 121
If the name of the outer class is , you can use the following within the inner class:

...Ariel
miguel lisboa
Ranch Hand

Joined: Feb 08, 2004
Posts: 1281
i tested, it works and looks much cleaner

thanks for that
 
I agree. Here's the link: http://zeroturnaround.com/jrebel - it saves me about five hours per week
 
subject: reference problem within inner class
 
Similar Threads
Inner Class
How to reference outer class from within inner class
Inner Classes
Cannot this an outer class instance from an inner class?
Generics: cannot make a static reference to the non-static type