|
How to load and draw an Image in an Applet |
|
|
This Java tip describes a method of loading and drawing image files in Java applets. The image should lie
on the same web server where the applet resides. Some time it may be the case that the developer may need
to sign the applet to get the audio file from the server.
Image theimage;
public void init() {
// The first thing is to load theimage
theimage = getImage(getDocumentBase(),
"http://server.com/theimage.gif");
}
public void paint(Graphics g) {
// Finally draw theimage
g.drawImage(theimage, 0, 0, this);
}
|
Related Tips
|
Page 1 of 0 ( 0 comments )
You can share your information about this topic using the form below!
Please do not post your questions with this form! Thanks.