Meaningless Drivel is fun!*
The moose likes Swing / AWT / SWT and the fly likes displaying java.awt.Image in a panel 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 "displaying java.awt.Image in a panel" Watch "displaying java.awt.Image in a panel" New topic
Author

displaying java.awt.Image in a panel

Dave Sammut
Greenhorn

Joined: Jul 02, 2002
Posts: 4
Hello,
I am having trouble with displaying an Image object on my panel within an applet.
I manage to display the image only after I scroll between windows i.e. alt+tab away from my applet window and then alt-tab back. I then see the image displayed in the applet's panel, however when I move(or even click) my mouse the image disappears again and I have to alt-tab back and forth to see the image displayed again.
any suggestions ?
thanks,
Dave
Dave Sammut
Greenhorn

Joined: Jul 02, 2002
Posts: 4
Hello again,
The problem seemed to be a cause of the JRE not refreshing my panel often enough. I extended the Panel object, created a setter method for my image and added my image to g.drawImage(myImage.... to the paint method of the extended Panel class.
I hope this helps someone out there.
Thanks,
dave
Nathan Pruett
Bartender

Joined: Oct 18, 2000
Posts: 4121

In the setter method are you calling repaint()? This would repaint your panel with the new image when it gets set...


-Nate
Write once, run anywhere, because there's nowhere to hide! - /. A.C.
Dave Sammut
Greenhorn

Joined: Jul 02, 2002
Posts: 4
No, I am not calling repaint()in my setter method however, it still paints the most recent image in good time. I'll add repaint() to the setter to further imporve things.
thanks,
dave
 
Consider Paul's rocket mass heater.
 
subject: displaying java.awt.Image in a panel
 
Similar Threads
Applet Looses Offscreen Image on changing browser
Handling the Event of the Image
I beg u all to help me out...
Applet dialog not getting focus when coming back to screen using Alt-Tab
Rules Roundup Q's not visable