This week's book giveaway is in the Agile and other Processes forum.
We're giving away four copies of The Mikado Method and have Ola Ellnestam and Daniel Brolund on-line!
See this thread for details.
The moose likes Java in General and the fly likes Inner class accessing outer class object 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 » Java in General
Reply Bookmark "Inner class accessing outer class object" Watch "Inner class accessing outer class object" New topic
Author

Inner class accessing outer class object

Abhishek Kaushik
Greenhorn

Joined: Mar 03, 2010
Posts: 14
My question is;

How you access the out class object from inner class in java

for example
i have one JFrame inside i defined one ActionListener like this



here the problem is i need the reference to parent JFrame window inside actionPerformed function to do tasks like window maximize and minimize etc.

Thanks in advance
Sagar Rohankar
Ranch Hand

Joined: Feb 19, 2008
Posts: 2896
    
    1

Resolve the scope of this, using the dot operator


[LEARNING bLOG] | [Freelance Web Designer] | [and "Rohan" is part of my surname]
Abhishek Kaushik
Greenhorn

Joined: Mar 03, 2010
Posts: 14
Sagar Rohankar wrote:Resolve the scope of this, using the dot operator


gotcha...yaa

OuterJFrameClassName.this

is the reference to parent class this object

thanks
 
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to run our stuff on 16 servers instead of 3.
 
subject: Inner class accessing outer class object
 
Similar Threads
Referencing an outer class from an inner class instance
Referencing Java classes
Anynomous
how to implement mvc or observer pattern on this java code ?
Blank JFrame