// Background Class // Background.java // Imports import java.awt.*; public class Background { protected Component component; protected Dimension size; public Background(Component comp) { component = comp; size = comp.size(); } public Dimension getSize() { return size; } 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); } }