This week's book giveaway is in the Kotlin forum.
We're giving away four copies of Kotlin in Action and have Dmitry Jemerov & Svetlana Isakova on-line!
See this thread for details.
Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Meaning of ClassName.this  RSS feed

 
Ralph Cook
Ranch Hand
Posts: 479
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm studying Philip Milne's JTreeTable article and example application, and ran across the following method within the class JTreeTable:



Can someone please enlighten me as to the meaning of "JTreeTable.this"? I thought it might just be a fancy way of saying "this", but the routine would then call itself without end.

rc
 
Devaka Cooray
Marshal
Posts: 5564
711
Chrome Eclipse IDE Google App Engine IntelliJ IDE jQuery Postgres Database Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
ClassName.this is a useful format to access the associated instance of the outer class, when the caller is an inner class. In such case, plain-old 'this' returns the instance of the inner class, while OuterClass.this returns the corresponding instance of the outer class.
 
Ralph Cook
Ranch Hand
Posts: 479
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks much. Don't use inner classes that much, have been out of Swing programming for a while...
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!