• Post Reply Bookmark Topic Watch Topic
  • New Topic

JTable  RSS feed

 
Mohamad Samy
Ranch Hand
Posts: 98
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
say i have jtable with anonymous class like

those methods are in the JTable API and i implement them in the anonymous class to match my need. which part code of program will call them to do their funciton to show the tool tip for example or the JVM will call them as in the rest of the program there is nothing calling them at all. please, explain it.
 
Martin Vajsar
Sheriff
Posts: 3752
62
Chrome Netbeans IDE Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
These methods are called either by other methods in the JTable itself, or by some other Swing code (in case of the getToolTipText method). There is a lot of code in the Swing library that you normally don't see (unless you go into JDK source codes, that is), yet it does a lot of work.

This isn't anything specific to JTable or Swing. You're creating a subclass of JTable (that it is an anonymous subclass isn't important) and overriding some of its methods. It's one of the key aspects of the object oriented programming. See also Method overriding.
 
Mohamad Samy
Ranch Hand
Posts: 98
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ok i got yoy. You mean some other codes in Jdk called those overriden metods
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!