0

ログイン画面を作成していますが、ユーザー認証プロセスを実行している間、進行状況インジケーターを表示したいと考えています。私はこのようなことをしています。

// Handler for Button[fx:id="login"] onAction
public void handleLogin(ActionEvent event) {
    // Show loading indicator
    showLoadingImg();

    // User authentication
    String userName = user.getText();
    String password = psw.getText();

    OrdLogin ord = new OrdLogin();
    ord.setUserName(userName);
    ord.setPassword(password);
    ord.run();

    Authentication auth = orden.getInfoAutenticacion();
    if(auth == null){
        // Remove the loading indicator
        contProgress.getChildren().remove(1);

        // Show an error message
        msgError.setText("Incorrect password/user");
        msgError.setPrefHeight(Region.USE_COMPUTED_SIZE);
    } else {
        // login successful!
                    ...
    }
}

private void showLoadingImg() {     
    // Show loading indicator
    ProgressIndicator progress = new ProgressIndicator();
    contProgress.getChildren().add(progress);
}

初期化メソッドで showLoadingImg() を実行すると、インジケーターは正しく表示されますが、handleLogin 内で showLoadingImg() を実行すると、インジケーターは表示されません。手がかりはありますか?

4

1 に答える 1

0

auth が null の場合、進行状況インジケーターは contProgress コンテナーから削除されています。これが発生しているかどうかを確認するためにソフトウェアをデバッグしましたか?

于 2012-11-08T15:56:52.400 に答える