Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

paint

 
chandan panda
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
what is the reason we call repaint() method to repaint the screen instead of calling paint() method?
 
Ernest Friedman-Hill
author and iconoclast
Marshal
Pie
Posts: 24212
35
Chrome Eclipse IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
Welcome to JavaRanch!
repaint() tells the JVM to schedule a screen paint for a convenient time; for example, when the CPU isn't too busy with something else. It also can "coalesce" paint requests, which means you can call repaint() 500 times in a row without forcing the screen to be repainted 500 times; requests that come close together can be combined into one. Finally, note that repaint() is sending a message to another thread to do the actual painting; this thread is dedicated to the task of doing GUI things, freeing up your application threads to do their own work.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic