Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8093691

Iconifying a maximized window corrupts iconifiedProperty

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Duplicate
    • Icon: P4 P4
    • 9
    • 8u45
    • javafx
    • None
    • Windows 7

      Iconifying and restoring a stage by clicking on the taskbar icon works fine.
      However, if the stage is maximized, iconifying only works once; after restoring the stage the iconifyProperty isn't update, also it's not updated when iconifying again. Only after un-maximizing the stage, the behavior returns to normal-

      {code}
      public class Main extends Application {

        @Override
        public void start(Stage primaryStage) throws Exception {
          VBox root = new VBox();

          Button iconifyButton = new Button("Iconify");
          iconifyButton.setOnAction(event -> primaryStage.setIconified(true));

          Button maximizeButton = new Button("Maximize");
          maximizeButton.setOnAction(event -> primaryStage.setMaximized(!primaryStage.isMaximized()));

          root.getChildren().addAll(iconifyButton, maximizeButton);

          primaryStage.iconifiedProperty().addListener((observable, oldValue, newValue) -> {
            System.out.println("Iconified: " + newValue);
          });
          primaryStage.maximizedProperty().addListener((observable, oldValue, newValue) -> {
            System.out.println("Maximized: " + newValue);
          });

          primaryStage.setTitle("Hello World");
          primaryStage.initStyle(StageStyle.UNDECORATED);
          primaryStage.setScene(new Scene(root, 100, 100));
          primaryStage.show();
        }


        public static void main(String[] args) {
          launch(args);
        }
      }
      {code}

            ddhill David Hill (Inactive)
            duke J. Duke
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported: