package paintgui;

import java.awt.Graphics;
import java.awt.Point;

public class ShapeRect implements Shape {

	private int x;
	private int y;
	private int w;
	private int h;

	public ShapeRect(Point start, Point end) {
		super();
		x = start.x < end.x ? start.x : end.x;
		y = start.y < end.y ? start.y : end.y;
		w = Math.abs(start.x - end.x);
		h = Math.abs(start.y - end.y);
	}

	@Override
	public void draw(Graphics g) {
		g.drawRect(x, y, w, h);
	}
}
