import java.applet.*; import java.awt.*; import java.net.*; import java.util.*; //===================================================================== // LoadImage public class LoadImage extends Applet { protected Image image; // image to display //---------------------------------------------------------- // INIT public void init() { // load the image to be displayed. image = this.getImage(this.getDocumentBase(),this.getParameter("image")); } //---------------------------------------------------------- // DESTROY // Called when the applet is being unloaded from the system. // We use it here to "flush" the image. This may result in memory // and other resources being freed quicker than they otherwise would public void destroy() { image.flush(); } //---------------------------------------------------------- // PAINT // Display the image. public void paint(Graphics g) { g.drawImage(image,0,0,this); } //---------------------------------------------------------- // UPDATE // We overwrite this method so that it doesn't clear the background // before calling paint(). Makes for less flickering in some situations. public void update(Graphics g) { paint(g); } }