I'm trying to do the a Javafx project. And I have some problem with it. I have a list of text (labels) placed inside the vBox. Is there a way to remove all the text in the vBox? For example, when I click a button "Remove", everything inside the vBox will be disappeared. Is it possible to do that?
HBox – arranges its content nodes horizontally in a single row. VBox – arranges its content nodes vertically in a single column.
VBox is a part of JavaFX. VBox lays out its children in form of vertical columns. If the vbox has a border and/or padding set, then the contents will be layed out within those insets. VBox class extends Pane class.
The layout panes HBox and VBox are definitely the most basic layout containers in JavaFX 2.0. As you can already tell by their name, their purpose is to layout all their children in one horizontal row ( HBox ) or in one vertical column ( VBox ).
Oh! I just figured it out. I can use vBox.getChildren().clear(); It works!
vBox.getChildren().removeAll(vBox.getChildren());
works too
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With