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

output of paint() not initially visible

 
Pavel Kovalev
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello folks,
A question from a newcomer:
I draw some stuff (rectangles) in my applet, but when it is started the output of paint() is not displayed - until I move the mouse over the applet frame. The same problem occurs when I minimize
and then restore the AppletViewer window.
BTW, some example applets from the JDK suffer from the same weird behavior. Can anybody tell me how to cure this?
Thanks in advance,
Pavel.
 
Dirk Schreckmann
Sheriff
Posts: 7023
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Welcome to JavaRanch!
Do you experience the same thing using the same code on a different machine (and/or JRE)?
How about some example code?
 
Pavel Kovalev
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Dirk Schreckmann:
Welcome to JavaRanch!
Do you experience the same thing using the same code on a different machine (and/or JRE)?
How about some example code?

Initially, I used JDK 1.4. Today I installed JDK 1.1.8_009 and everything started working magically. From the beginning I suspected that the problem with output is a 1.4 "feature", now I am positive that this is a bug in 1.4.
I think I will not be posting any source code - if you like you can see the problem yourself if you run the ArcTest demo provided with the JDK in the 1.4 environment.
Regards,
Pavel.
 
Altaf Ahmad
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Pavel,
I am having the same kind of issues these days. I have been able to locate some info. Swing controls will not refresh themselves if you make the change outside of a standard event control mechanism. If you modify it in a module that is not responding to some user event, then that code should be run in a separate thread.
Check out the swing connection for more info.
http://java.sun.com/products/jfc/tsc/articles/threads/threads1.html
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic