D
D
Denis Ilinykh2016-03-05 16:45:24
Java
Denis Ilinykh, 2016-03-05 16:45:24

How to activate buttons when changing ROOT from STAGE?

Making forms in FXML
Switching between them

private void showStage(String fxml_source){
    root = FXMLLoader.load(getClass().getResource(fxml_source));
    Scene scene = new Scene(root);
    stage.setScene(scene);
    stage.show();
    Platform.runLater(new Runnable() {
            @Override
            public void run() {
                System.out.println("Search on:"+fxml_source);
                for (Node node : anchorPane.getChildren()) {
                    System.out.println("Id: " + node.getId());
                    if (node instanceof Button) {
                        ((Button)node).setDisable(false);
                    }
                }
            }
        });
}

there are screens where I have the buttons turned off beforehand and I can’t figure out how to activate them after a while.
I'm trying to do it through RunLater, but it fires on the currently loaded FXML and not on the one that will be loaded
according to the log, I see that runlater fires on a screen that will already be hidden

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question