2
一個JavaFX的階段,它原本可調整大小無法顯示一個模態對話框後,再調整後調整。這隻發生在Linux:Ubuntu和XUbuntu。它在Windows中正常工作。JavaFX的階段不能顯示一個對話框
下面的代碼顯示一個按鈕的窗口。最初的窗口可以調整大小而沒有問題。點擊按鈕後會顯示警報對話框,此後窗口不能再調整大小。有什麼我在這裏失蹤?這是一個Ubuntu錯誤?
import javafx.application.Application;
import javafx.scene.Scene;
import javafx.scene.control.Alert;
import javafx.scene.control.Button;
import javafx.scene.control.ButtonType;
import javafx.scene.control.Alert.AlertType;
import javafx.scene.layout.StackPane;
import javafx.stage.Stage;
public class StageTest extends Application {
@Override
public void start(Stage primaryStage) throws Exception {
primaryStage.setTitle("Hello World!");
Button btn = new Button();
btn.setText("Show Alert");
btn.setOnAction(e -> {
Alert alert = new Alert(AlertType.WARNING, "This is an alert", ButtonType.YES);
alert.showAndWait();
});
StackPane root = new StackPane();
root.getChildren().add(btn);
primaryStage.setScene(new Scene(root, 1000, 850));
primaryStage.show();
}
public static void main(String[] args) {
launch(args);
}
}
您使用的是哪個JDK版本? – ItachiUchiha
我使用JDK 1.8.0_60-b27 –
我可以確認此問題無法在MacOSX 10.10.5 + JDK 1.8.0_60上重現。 – ItachiUchiha