public void mouseReleased(MouseEvent e) {
        if (e.getModifiers() == MouseEvent.BUTTON1_MASK) {
            if (isValidPosition(e.getX(), e.getY())) {
                mouseX = e.getX();
                mouseY = e.getY();
            }
            selectObstacle(e.getX(), e.getY());
            mouseLeftClick = false;
        } else {
            if (mouseRightClick) {
                mouseEndX = e.getX();
                mouseEndY = e.getY();
                if (Math.max(mouseStartX, mouseEndX) - Math.min(mouseStartX, mouseEndX) > 2
                        && Math.max(mouseStartY, mouseEndY) - Math.min(mouseStartY, mouseEndY) > 2) {
                    if (xBak < Math.max(mouseStartX, mouseEndX) && xBak > Math.min(mouseStartX, mouseEndX)
                            && yBak < Math.max(mouseStartY, mouseEndY) && yBak > Math.min(mouseStartY, mouseEndY)) {
                        System.out.println("Overlapping Obstacle");
                    } else {
                        dataBus.getObstacles().add(new PdoRectangle(mouseStartX, mouseStartY, mouseEndX, mouseEndY, DataBus.RECTANGLE_ARC_SIZE));
                    }
                }
                mouseRightClick = false;
            } else {
                treeMenu.show(this, e.getX(), e.getY());
            }
        }
    }