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 Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to get an image in a Canvas

Status
Not open for further replies.

gransbpa

Programmer
Jun 5, 2001
98
NL
Hi there,

I just started programming in Java, and made a simple applet to show an image loaded from a directory, using the drawImage and getImage methods. Now I want to make the same functionality in an application, using a Canvas instead of an applet, but the above function only seem to function when applied to applets. Does anyone know how to do this?

Thanks.
 
Instead of your class extending Applet, have it extend JFrame.
 
Thanks for your reaction Sedj, unfortunately it did not work. Somehow the compiler keeps complaining that it does not recognize the terms getDocumentbase and getCodeBase I use in my applet to refer to the images to be loaded. They seem to be typical Applet methods.
 
Yes, you will obviously have to change some methods ...
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top