Rectangle r = currentShape.getBounds(); int width = Math.abs(r.x-p.x), height = Math.abs(r.y-p.y); ROIFactory.setShapeBounds(currentShape, currentROI.getShapeType(), r.x, r.y, width, height); moving = true; view.draw(currentShape);
Rectangle r = currentROI.getShape().getBounds(); int x = r.x, y = r.y, w = r.width, h = r.height; switch (resizeZone) { case LEFT: x = p.x; w += anchor.x-p.x; break; case RIGHT: w += p.x-anchor.x; break; case TOP: y = p.y; h += anchor.y-p.y; break; case BOTTOM: h += p.y-anchor.y; } if (areaValid(x, y, w, h)) { currentShape = ROIFactory.makeShape(currentROI.getShapeType(), x, y, w, h); view.draw(currentShape); moving = true;  }
    private void resize(Point p)    {        Rectangle r = currentShape.getBounds();        int width = Math.abs(r.x-p.x),             height = Math.abs(r.y-p.y);         ROIFactory.setShapeBounds(currentShape, currentROI.getShapeType(),                                  r.x, r.y, width, height);        moving = true;        view.draw(currentShape);     }