Javafx 2 : How do I delete a row or column in Gridpane

Natty picture Natty · Apr 11, 2014 · Viewed 23.7k times · Source

If I want to add a row of text fields programatically in JavaFx, i can simply use the gridpane add method

This adds a set of text fields to row 1.

for (int i = 0; i < Fields.size(); i++) {
   gridpane.add(new TextField(), i, 1);
}

Similarly, How do I delete a row?. I dont find a suitable method to delete a row/column conveeniently in JavaFX.

Answer

James_D picture James_D · Apr 11, 2014

There's no directly equivalent method. To remove nodes, just use gridpane.getChildren().remove(...); or gridpane.getChildren().removeAll(...); and pass in the nodes you want to remove from the pane.