I have an multi-window javafx mailbox project.Which is realized by turning the visibility and availability true and false of the window(anchorpane). now I hava two windows (paneA and B),When i switch from A to B,because there is a process where i need to load some information into the pane B and which would take some time, I wanted to make an progressindicator to show that panel B is actually loading information.
but the problem is,even if i set the progress-indicator's visibility and availability true before i called the loading function and switching pane function,the progress-indicator only show after the loading was finished.
i tried to set the progress-indicator's visibility and availability in another thread and it also wont work properly(show after the loading)
"loading" in the code is the fxml id of the progressindicator
here is the code:(the code is part of the controller.java)
//open inboxpage
    public void OpenBox() {
        this.loading.setVisible(true);//loading is the id of the progress indicator
        this.loading.setDisable(false);
        
        SendPane.setDisable(true);
        SendPane.setVisible(false);
        SettingPane.setDisable(true);
        SettingPane.setVisible(false);
        
        BoxPane.setDisable(false);
        BoxPane.setVisible(true);
        
        if(account.length()+pwd.length()<2) {
            //this.loading.setVisible(false);
            //this.loading.setDisable(true);
            this.MailDisplay.setText("Please fill in your infos");
        }else {
            this.MailDisplay.clear();
            LoadMails(account,pwd);
            //this.loading.setVisible(false);
            //this.loading.setDisable(true);
        }
    }
the truth is ,if i use the code below,the progress indicator won't show at all(the indicator show after loading,but it was set to unvisible soon after showing)
//open inboxpage
    public void OpenBox() {
        this.loading.setVisible(true);//loading is the id of the progress indicator
        this.loading.setDisable(false);
        
        SendPane.setDisable(true);
        SendPane.setVisible(false);
        SettingPane.setDisable(true);
        SettingPane.setVisible(false);
        
        BoxPane.setDisable(false);
        BoxPane.setVisible(true);
        
        if(account.length()+pwd.length()<2) {
            this.loading.setVisible(false);
            this.loading.setDisable(true);
            this.MailDisplay.setText("Please fill in your infos");
        }else {
            this.MailDisplay.clear();
            LoadMails(account,pwd);
            this.loading.setVisible(false);
            this.loading.setDisable(true);
        }
    }
