sclass BoxWithColor { Pt a, b; RGB color; *() {} *(Pt *a, Pt *b, RGB *color) {} public void renderOn(Graphics2D g, int w, int h) { int x1 = min(a.x, b.x), y1 = min(a.y, b.y); int x2 = max(a.x, b.x), y2 = max(a.y, b.y); fillRect(g, x1, y1, x2-x1+1, y2-y1+1, toColor(color)); } public void renderHints(Graphics2D g, int w, int h) { int x1 = min(a.x, b.x), y1 = min(a.y, b.y); int x2 = max(a.x, b.x), y2 = max(a.y, b.y); drawRect(bi, x1, y1, x2-x1+1, y2-y1+1, hintColor()); } }