wood burning stoves*
The moose likes Swing / AWT / SWT and the fly likes Images sometimes don't display Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "Images sometimes don Watch "Images sometimes don New topic
Author

Images sometimes don't display

Matt Hansen
Ranch Hand

Joined: Jul 31, 2001
Posts: 34
I created an ImagePanel which extends JPanel. I use this to display images by overriding the paint method. Usually the image appears but sometimes it doesn't appear until I manually force it to be redrawn by moving a window in front of it. Anyone have an idea how to fix this?
Thanks
Nathan Pruett
Bartender

Joined: Oct 18, 2000
Posts: 4121

It might be that you need to load the image with MediaTracker before trying to display it... but I don't know unless I see your code...

Here's a similiar class I made with the AWT Panel that works...



HTH,
-Nate


-Nate
Write once, run anywhere, because there's nowhere to hide! - /. A.C.
Matt Hansen
Ranch Hand

Joined: Jul 31, 2001
Posts: 34
Thanks, that was the problem! I added that and now it displays every time.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Images sometimes don't display