をクリックした後、私は特定のファイルの新しいバージョンが利用可能であるかどうかを確認するJavaデスクトップアプリを持っており、それをダウンロードするようにユーザーに尋ねます。ユーザーが「はい」をクリックすると、質問は表示されたままになり、「ダウンロードしてください、お待ちください」というメッセージは表示されません。しかし、私は...JavaFXの変更シーンボタン
private void updateAvailable(Stage stage) {
stage.setTitle("A new version is available. Update?");
stage.initStyle(StageStyle.UNDECORATED);
Label label = new Label(stage.getTitle());
label.setStyle("-fx-font-size: 25");
Button yesButton = new Button("YES");
Button noButton = new Button("NO");
HBox buttons = new HBox(10, yesButton, noButton);
buttons.setAlignment(Pos.CENTER);
yesButton.setStyle("-fx-font-weight: bold");
yesButton.setOnAction(event -> downloadFiles());
noButton.setStyle("-fx-font-weight: bold");
noButton.setOnAction(event -> executeApp());
VBox root = new VBox(label, buttons);
root.setAlignment(Pos.CENTER);
root.setSpacing(20);
root.setPadding(new Insets(25));
root.setStyle("-fx-border-color: lightblue");
stage.setScene(new Scene(root));
stage.show();
}
private void downloadFiles(){
updaterService.backupCurrentVersion();
updaterService.downloadNewestVersion();
}
は、私は、新しいシーンを(ダウンロードが開始される前に)ダウンロード方法の内側に新しいシーンを作成して、電流を隠そうとしたが、うまくいかなかったことをやるのか分かりませんダウンロードが完了すると点滅するだけです。
は何これを行うための最善のaproachでしょうか?私はシーンがどのように動作するか分かりません。
。 – FranAguiar
これは問題ではありません。ダウンロードを開始するには数秒後にこのダイアログを閉じることができます。 –
私はその動作が正しいことを知っていますが、私の目的のためにはうまくいかず、私はユーザにとって使いやすいものでなければならず、そのダイアログは彼らを混乱させます。 何かが起こっていることを知らせたいだけです。座って待ってください。 – FranAguiar