private void replaceElement(MouseEvent e) {
        final Panel screen = (Panel) e.getSource();
        final double xMax = screen.getWidth() - 1;
        final double yMax = screen.getHeight() - 1;
        double x = e.getX();
        double y = e.getY();
        x = x > xMax ? xMax : x < 0 ? 0 : x;
        y = y > yMax ? yMax : y < 0 ? 0 : y;
        win.getModel().replaceLast(getNewElement(ptPress, new Point2D.Double(x, y)));
        screen.repaint();
    }