Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

how to understand "anonymous inner classes"  RSS feed

 
Forman Smith
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I want to let the JLbale move with mouse,so i tried this:




This does not work, something wrong in line 33.

But when i tryed this that i move the code frome line 44 to line 48 and place them under line 33,it works. i find this called "anonymous inner classes", but i don't quite understand.


Who can explain this to me? Thanks!
 
Darryl Burke
Bartender
Posts: 5167
11
Java Netbeans IDE Opera
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Forman, have you discovered the Oracle tutorials? I suggest you start with the lesson on Nested Classes and work your way down to Anonymous Classes.
 
Campbell Ritchie
Sheriff
Posts: 53769
127
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Use Java8 and you can dispense with 90% of your anonymous classes.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!