Win a copy of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js this week in the JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

super.paint(g) problem  RSS feed

 
memati bas
Ranch Hand
Posts: 85
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,
Some thing makes me confused about the below codes.
I do not exactly understand why we should use super.paint(g) at the below.
What is the logic of it ??



If we do not use it, so our background image can not be permanent, so why ??

Thanks
 
Ernest Friedman-Hill
author and iconoclast
Sheriff
Posts: 24217
38
Chrome Eclipse IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Whenever you override a method x, if the method you're overriding does something useful, then calling super.x() is a good idea.

Whether you need to call super.paint() depends on what paint() does in the class you're extending.
 
memati bas
Ranch Hand
Posts: 85
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for this Ernest but I need more explanatory explanation. If anyone know more explanatory that Erenest's, please inform me.
 
Michael Dunn
Ranch Hand
Posts: 4632
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
this link mainly describes paintComponent, but might give some insight

http://java.sun.com/docs/books/tutorial/uiswing/14painting/concepts.html
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!