@Override
	public void mouseReleased(MouseEvent m) {

		if(drawing) {
			
			drawing = false;
			
			if(m.getY() == ry && m.getX() == rx)
				return;
			
			rheight = m.getY() - ry;
			rwidth  = m.getX() - rx;
						
			if(rheight < 0) {
				rheight = -rheight;
				ry = m.getY();
			}
						
			if(rwidth < 0) {
				rwidth = -rwidth;
				rx = m.getX();
			}
				
			rects.add(new Rectangle(rx, ry, rwidth, rheight));
			paintComponent(getGraphics());
		}
		
		
		

	}