• Post Reply Bookmark Topic Watch Topic
  • New Topic

question about JPanel paintCompotent  RSS feed

 
Ignas Sliuzas
Greenhorn
Posts: 13
Firefox Browser Java Notepad
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi everyone, I've got a quick question about how paintCompotent works.

for example I have this code:


I believe the line paintPanel.repaint() would not work because the repaint() request works something like a queue where java just adds the request to the queue and performs it when the object has finished it's work. Correct me if I'm wrong please.

So I think you pretty much know what I have trouble with. I need the screen of my JPanel to repaint at certain intervals of time.. If anyone has any suggestions or comments or approaches that I should take please let me know.

Thanks.
 
Rob Spoor
Sheriff
Posts: 20895
81
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Check out javax.swing.Timer.

Moving to our GUI forum.
 
Darryl Burke
Bartender
Posts: 5167
11
Java Netbeans IDE Opera
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Never call sleep(...) on the EDT unless you want to freeze your GUI. Check out the Swing tutorial on concurrency at http://java.sun.com/docs/books/tutorial/uiswing/concurrency/index.html
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!