0
最新のJDK:1.8.0_102で動作していますが、1.8.0_45でも動作しませんでした。 問題を再現する簡単なプログラムです。再現する手順:JavaFX Stage.setMaximizedはMac OSX(10.9.5)で一度しか動作しません
- 実行プログラム
- 最大化(それは正しく最大化されます)
- クリックして(それは正しく「unmaximize」意志)[復元]をクリックします
は(それは何もしません)もう一度最大化をクリックします。
import javafx.application.Application; import javafx.event.ActionEvent; import javafx.event.EventHandler; import javafx.scene.Scene; import javafx.scene.control.Button; import javafx.scene.layout.VBox; import javafx.stage.Stage; public class TestApplication extends Application { @Override public void start(Stage primaryStage) throws Exception { VBox pane = new VBox(); Button maximizeButton = new Button("Maximize"); pane.getChildren().add(maximizeButton); Button restoreButton = new Button("Restore"); pane.getChildren().add(restoreButton); maximizeButton.setOnAction(new EventHandler<ActionEvent>() { @Override public void handle(ActionEvent event) { primaryStage.setMaximized(true); } }); restoreButton.setOnAction(new EventHandler<ActionEvent>() { @Override public void handle(ActionEvent event) { primaryStage.setMaximized(false); } }); primaryStage.setScene(new Scene(pane)); primaryStage.show(); } public static void main(String[] args) { launch(args); } }
私は、復元するステップの一部であったrestoreButton.setOnActionでsetMaximized(false)を呼び出します。私は何か違うことをすべきか? –
@EricS。私は例で私の答えを更新しました! –