import java.awt.*; import java.awt.Graphics2D; public class ColoredRect extends DrawableRect { protected Color border, fill; public ColoredRect(DrawableRect r) { super(r.x1, r.y1, r.x2, r.y2); this.border=Color.black; this.fill=Color.white; } public ColoredRect(Rect r) { super(r); this.border=Color.black; this.fill=Color.white; } public ColoredRect(DrawableRect r, Color border, Color fill) { super(r.x1, r.y1, r.x2, r.y2); this.border=border; this.fill=fill; } public ColoredRect(Rect r, Color border, Color fill) { super(r); this.border=border; this.fill=fill; } public ColoredRect(int x1, int y1, int x2, int y2, Color border, Color fill) { super(x1, y1, x2, y2); this.border=border; this.fill=fill; } public void draw(Graphics2D g) { g.setColor(fill); g.fillRect(x1, y1, (x2-x1), (y2-y1)); g.setColor(border); g.drawRect(x1, y1, (x2-x1), (y2-y1)); } }