// Background Class // Background.java // Project 3, CIS 525 // Fall 2000 // By Terrence Burrows // Imports import java.awt.*; /** This class is used as the basis of the game 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 Background { protected Component component; protected Dimension size; /** Background class constructor method - sets background size */ public Background(Component comp) { component = comp; size = comp.size(); } /** Returns Background size */ public Dimension getSize() { return size; } /** Draw Background in a single color */ public void draw(Graphics g) { // Fill with component color g.setColor(component.getBackground()); g.fillRect(0, 0, size.width, size.height); g.setColor(Color.black); } }