I need to create a Java applet (1.5) and I have
almost no idea what I'm doing. I found a tutorial that described how to draw lines and squares, but how do I draw a PNG image? I tried looking at the Java 5 API but I couldn't even figure out how to properly get the image into an image object...
Here's all I have so far:
Code:
import java.applet.Applet;
import java.awt.Graphics;
import java.awt.Image;
//No need to extend JApplet, since we don't add any components;
//we just paint.
public class Simple extends Applet {
StringBuffer buffer;
public void init() {
}
public void start() {
paint();
}
public void stop() {
}
public void destroy() {
}
public void paint(Graphics g) {
Image img = ??? PNG from http://example.com/example.png ???
g.drawImage(img, 20, 20, ???);
}
}