0
로그인 화면에서 사용자 인증 프로세스를 진행하는 동안 진행 상태 표시기를 표시하려고합니다. 나는 이렇게하고있다. 내 초기화 방법에 showLoadingImg()를 실행하면JavaFX 진행 표시기로 이상한 동작이 발생했습니다.
// 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);
}
는 표시가 올바르게 표시됩니다,하지만 난 handleLogin 내부 showLoadingImg()를 수행 할 때 표시기가 표시되지 않습니다. 실마리가 있습니까?
예. Auth가 null이 아닙니다. 내가 디버깅을하고 runLater 메소드가 결코 예상대로 읽히지 않을 때. 어쩌면 스레드가 주 스레드와 충돌할지 모르겠다. –