This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
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 Android Security Essentials Live Lessons this week in the Android 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.
 
Don't get me started about those stupid light bulbs.
 
subject: Images sometimes don't display
 
Similar Threads
display image problem on jsp
retrieve multiple images from mysql
Dispaly all images of folder
Missing Images
Showing image files from a file system in a JSP