public void update(Point p) {
        ((Rectangle) shape).setFrameFromDiagonal(firstpoint, p);
        this.initialHeight = ((Rectangle) shape).height;
        this.initialWidth = ((Rectangle) shape).width;
        this.initialPoint = new Point(((Rectangle) shape).x, ((Rectangle) shape).y);
        updateCornerRects();
        canvas.repaint();
    }