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.
A friendly place for programming greenhorns!
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
Author
Inner class accessing outer class object
Abhishek Kaushik
Greenhorn
Joined: Mar 03, 2010
Posts: 14
posted
Mar 25, 2010 00:15:18
0
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
ActionListener menuListner = new ActionListener() { public void actionPerformed(ActionEvent evt) { //some action }
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
I like...
posted
Mar 25, 2010 00:24:39
0
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
posted
Mar 25, 2010 00:44:44
0
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
All times are in JavaRanch time: GMT-6 in summer, GMT-7 in winter