T
T
TopMetaFizick_0102018-08-09 21:12:23
JavaFX
TopMetaFizick_010, 2018-08-09 21:12:23

JavaFx how to uninstall Node?

I created a GridPane panel, hung a listener on it, when I click the mouse, I calculate the cell address, create a new object like Ellipse, ImageView, and put it in this cell. How can I dynamically delete and replace these objects ? Is it possible to clear a specific GridPane cell? Please include code if possible, thanks in advance.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
C
Cheypnow, 2018-09-27
@Cheypnow

grid.getChildren().remove();

V
Vadim, 2020-02-19
@VADMARK

If there is a reference to a Node, then it can be removed gridPane.getChildren().remove(node);
If there is no link, then only redraw the entire table:
gridPane.setGridLinesVisible(false);
gridPane.getColumnConstraints().clear();
gridPane.getRowConstraints().clear();
gridPane.getChildren().clear();
gridPane.setGridLinesVisible(true);

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question