Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Frame repain on startup.

Status
Not open for further replies.

EugeneG

Technical User
Oct 2, 2001
7
US
Hi!

Does anyone know how to fix this?

I'm using an awt Frame for a simple key-driven animation. Load some images and paint them over one another in the process. But when the frame loads for the first time there is nothing on it - just a plain white rectangle... sometimes one of the actor appears... sometimes none (usually none)... as soon as I start pressing keys or minimize/maximize the frame, everything paints correctly. Calling repaint() before or after the setVisible() doesn't seem to help. What's going on?
 
Without seeing the code it's hard to say but one
likely scenario is that the images aren't loading
on time. If you are not using a MediaTracker to
load images then do so. Use the MediaTracker.waitForAll
method to ensure that the images are loaded before
proceeding.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top