Search code examples
javajavafxgridpane

Getting a Boolean value JAVAFX


I have a group of nodes within a GridPane and have some listeners adding and removing those nodes from the GridPane.

I was wondering if there is a way for me to create a get method(Boolean) or such to test if the nodes are currently in the GridPane or not.

I want to enable the button when the nodes aren't in the gridpane aka false.

Any help/thoughts appreciated!


Solution

  • That's how you can check for the presence of a node:

    gridpane.getChildren().contains(yourNode);