//CS5-HMC-Sp.,00-HW13-3 //A. Khakpour, May, 00 import java.applet.*; import java.awt.*; public class Mirror extends Applet { private final int W = 320; private final int MIN = 20; // smallest picture size private Image world, everest, goat; //----------------------------------------------------------------- // Loads the images. //----------------------------------------------------------------- public void init() { world = getImage (getDocumentBase(), "world.gif"); everest = getImage (getDocumentBase(), "everest.gif"); goat = getImage (getDocumentBase(), "goat.gif"); } //----------------------------------------------------------------- // Draws the three images, then calls itself recursively. //----------------------------------------------------------------- public void drawPictures (int size, Graphics g) { g.drawImage (everest, W-size, W-size/2, size/2, size/2, this); g.drawImage (goat, W-size/2, W-size, size/2, size/2, this); g.drawImage (world, W-size, W-size, size/2, size/2, this); if (size > MIN) drawPictures (size/2, g); } //----------------------------------------------------------------- // Performs the initial call to the drawPictures method. //----------------------------------------------------------------- public void paint (Graphics g) { drawPictures (W, g); } }