JDK-8087997 : Iconifying a maximized window does not change the iconified property, when window is un-iconified again
  • Type: Bug
  • Component: javafx
  • Sub-Component: window-toolkit
  • Affected Version: 8,9
  • Priority: P4
  • Status: Closed
  • Resolution: Duplicate
  • Submitted: 2014-04-30
  • Updated: 2016-10-06
  • Resolved: 2016-10-06
Related Reports
Duplicate :  
Duplicate :  
Duplicate :  
Duplicate :  
Relates :  
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();
    }
}
Comments
This bug is "In Progress" status now, so re-targeting back to Fix Version 9. If you are not working on this bug fix anymore, please update the bug from "In Progress" to just "Open"
13-11-2015