// ImageBackground Class // ImageBackground.java // Project 3, CIS 525 // Fall 2000 // By Terrence Burrows // Imports import java.awt.*; /** This class extends the "Background" class so that the game background can be be an image and not just a single color background. This class is taken directly from the book "Teach yourself Internet Game Programming with Java in 21 days" by Michael Morrison. See chapter 6 for details. */ public class ImageBackground extends Background { protected Image image; /** ImageBackground constructor method sets image for background */ public ImageBackground(Component comp, Image img) { super(comp); image = img; } /** Return the background "image" object */ public Image getImage() { return image; } /** Sets image for background */ public void setImage(Image img) { image = img; } /** Draw background image. */ public void draw(Graphics g) { // Draw background image g.drawImage(image, 0, 0, component); } }