When a stage is maximized -> iconified -> restored, the iconifiedProperty of the stage won't get properly updated. The test below demonstrates the behavior - when the stage is iconified newValue is true, when the stage is restored the listener does not receive any event.The issue does not occur if the stage is not maximized. The issue also occurs with Java 8u20 b11. The issue was already reported as RT-32508 but still exists, so please fix - currently it's pretty difficult to create a properly working non-native window decoration.
public class IconifiedPropertyTest extends Application
{
public static void main(String[] args)
{
Application.launch(IconifiedPropertyTest.class, args);
}
@Override
public void start(Stage stage)
{
stage.iconifiedProperty().addListener(new ChangeListener<Boolean>()
{
@Override
public void changed(ObservableValue<? extends Boolean> observable, Boolean oldValue, Boolean newValue)
{
System.err.println("isIconified: " + newValue);
}
});
BorderPane root = new BorderPane();
Scene scene = new Scene(root, 800, 600);
stage.setScene(scene);
//iconifiedProperty works fine if window is not maximized
stage.setMaximized(true);
stage.show();
}
}