File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
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
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
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: displaying java.awt.Image in a panel