@Override
	public void paintComponent(Graphics g) {
		super.paintComponent(g);
		Graphics2D g2 = (Graphics2D) g;

		//draw points
		for (Point p : points) {
			g.drawRect(p.x, p.y, 1, 1);
		}

		//draw rectangle
		if (rectangle != null) {
			for (int i = 0; i < 4; i++) {
				Point p1 = rectangle[i];
				Point p2 = rectangle[(i + 1) % 4];
				g2.drawLine(p1.x, p1.y, p2.x, p2.y);
			}
		}

		super.repaint();
		//g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);

	}