"how to load big file in background during initialize() method of javafx?" Code Answer

4

i try this and its work easily...here bar is a progress bar

    @fxml
    void initialize () {
        assert bar != null : "fx:id="bar" was not injected: check your fxml file 'check.fxml'.";
        loadappconfigurationfile();
    }

    private void loadappconfigurationfile () {
        task task = new task<void>() {
            @override
            public void call() throws interruptedexception {
                int max = 1000000;
                for (int i = 1; i <= max; i = i + 10) {
                    if (iscancelled()) {
                        break;
                    }
                    updateprogress(i, max);
                    system.out.println("somethings is here");
                }
                return null;
            }
        };
        bar.progressproperty().bind(task.progressproperty());
        new thread(task).start();
    }
By Arjun saini on March 13 2022

Answers related to “how to load big file in background during initialize() method of javafx?”

Only authorized users can answer the Search term. Please sign in first, or register a free account.