Issue
If I know the specific coordinate of the node I am trying to remove, let's say "col:3, row: 4", how can I remove the node in column 3 and row 4? Is there a built-in method I can use in Java?
Solution
You need to remove node (child) from layout (GridPane)
public Node removeNodeByRowColumnIndex(final int row,final int column,GridPane gridPane) {
ObservableList<Node> childrens = gridPane.getChildren();
for(Node node : childrens) {
if(node instanceof ImageView && gridPane.getRowIndex(node) == row && gridPane.getColumnIndex(node) == column) {
ImageView imageView=ImageView(node); // use what you want to remove
gridPane.getChildren().remove(imageView);
break;
}
}
}
Answered By - Menai Ala Eddine - Aladdin
Answer Checked By - Timothy Miller (JavaFixing Admin)