// load an image and display it in its original size and
// scale it to half its original width and height
import java.applet.Applet;
import java.awt.*;
public class LoadImage extends Applet {
private Image img;
public void init()
// load the image when the applet begins executing
{
img = getImage( getDocumentBase(), "images/world.jpg");
}
public void paint(Graphics g)
{
// draw the original image
g.drawImage(img, 1, 1, this);
// now half the size of the image
int width = img.getWidth( this );
int height = img.getHeight( this );
g.drawImage(img, 1, 150, width / 2, height / 2, this);
}
}