Suppose I have the following two rectangles and I wanted to delete one:
I know how to implement the delete button method, however I do not know how I can select between the shapes through a mouse-click. Could someone please give me some guidelines/examples as to how I would go about this. Thanks
Edit - Where I construct the rectangle:
if (treeview.getSelectionModel().getSelectedItem() == greenrect) {
Rectangle rect = drag.createDraggableRectangle(200, 60, 200, 60);
ObjectProperty<Point2D> mousePosition = new SimpleObjectProperty<>();
GraphicsContext gc = canvas.getGraphicsContext2D();
rect.setFill(Color.GREEN);
container2.getChildren().addAll(rect);
}