• Post Reply Bookmark Topic Watch Topic
  • New Topic

Swingworker question  RSS feed

 
Ruben Demuynck
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hello,
I was wondering how to acces a variable in the outher class from an anonymous inner class. The code is like this:

The 'this' has to be the class in which the swingworker is created but in this example the 'this' is the anonymous swingworker class.
How do i acces the outer class??
 
David Harkness
Ranch Hand
Posts: 1646
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
There might be some trick way to get it using syntax similar to super.this, but I'm not familiar with it. How about this?
 
Ruben Demuynck
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
yip there is i just discovered it yesterday.
in stead of outer.this its the name of the Outer class.this
in my case it was MainGui.this
thx for the reply
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!