import java.awt.Graphics2D; public class DrawableRect extends Rect { public DrawableRect(Rect r) { super(r.x1, r.y1, r.x2, r.y2); } public DrawableRect(int x1, int y1, int x2, int y2) { super(x1, y1, x2, y2); } public void draw(Graphics2D g) { g.drawRect(x1, y1, (x2-x1), (y2-y1)); } }