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

Iconifying a maximized window does not change the iconified property, when window is un-iconified again

    XMLWordPrintable

Details

    • Bug
    • Resolution: Duplicate
    • P4
    • None
    • 8, 9
    • javafx

    Description

      1. Start the app
      2. Maximize the window
      3. Iconify the window (put it in the taskbar by either clicking on the taskbar icon or using the minimize icon in the window)
      4. Click on the taskbar icon again, which maximizes the window again.
      5. Click the button. => stage.isIconified() returns true, although the window is maximized and not in the taskbar (not iconified) anymore.

      This causes trouble, when you want to listen to changes to the iconifiedProperty.

      I am also not sure, if the maximized and iconified property should be exclusive, i.e. should the maximized property be true, while it is iconified?

      (Tested only on Windows 7, don't know if other platforms are affected, too)

      import javafx.application.Application;
      import javafx.beans.value.ChangeListener;
      import javafx.beans.value.ObservableValue;
      import javafx.event.ActionEvent;
      import javafx.event.EventHandler;
      import javafx.scene.Scene;
      import javafx.scene.control.Button;
      import javafx.stage.Stage;

      public class TestApp3 extends Application {
          public static void main(String[] args) {
              launch(args);
          }

          @Override
          public void start(final Stage stage) {

              stage.iconifiedProperty().addListener(new ChangeListener<Boolean>() {
                  @Override
                  public void changed(ObservableValue<? extends Boolean> observableValue, Boolean aBoolean, Boolean aBoolean2) {
                      System.out.println("Iconified: " + aBoolean2);
                      System.out.println("Maximized: " + stage.isMaximized());
                  }
              });

              Button button = new Button("Click");
              button.setOnAction(new EventHandler<ActionEvent>() {
                  @Override
                  public void handle(ActionEvent actionEvent) {
                      System.out.println("Iconified: " + stage.isIconified());
                      System.out.println("Maximized: " + stage.isMaximized());
                  }
              });

              Scene scene = new Scene(button);
              stage.setScene(scene);
              stage.show();
          }
      }

      Attachments

        Issue Links

          Activity

            People

              mbilla Murali Billa
              cschudtjfx Christian Schudt (Inactive)
              Votes:
              1 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:
                Imported: