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

repaint and Paint  RSS feed

 
vishwas bhatt
Ranch Hand
Posts: 129
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
paint(Graphics g){
System.out.println("aaaaa");
}
now if we call repaint in for loop 100 then it should call paint 100 times and print "aaaaa"
but it is not happening why.
 
Nathan Pruett
Bartender
Posts: 4121
IntelliJ IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Repaint() makes calls to the background painting routines hidden away somewhere in the JVM. Basically, it's just a request for a repaint. repaint() doesn't do an actual repaint for each time it is called because that would actually make painting slower. This would happen if repaint() was called faster than the screen could refresh or that calculations needed for the paint could be computed. So the painting routines queue up the repaint requests and only do repaints as fast as it can.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!