-
Bug
-
Resolution: Cannot Reproduce
-
P4
-
None
-
jfx21
-
x86_64
-
linux_redhat_6.0
ADDITIONAL SYSTEM INFORMATION :
Red Hat 7.9
A DESCRIPTION OF THE PROBLEM :
If a stage has a max height or width set that is less than the screen width or height, maximizing the window does nothing. On Windows, it will maximize from the top left corner until a max is reached.
If a stage has a min height or width set, the window is shrunk down to that size, then maximized and unmaximized, unmaximizing does nothing.
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Using the provided source code:
1. Shrink the window size to the minimum size
2. Maximize the window
3. Unmaximize the window
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
Step 2: The window has the unmaximize button indicating it is maximized. The window moves to the top left corner and expands to the set max width and height
Step 3: The window has the maximize button indicating it is not maximized. The window returns to it's original position and size (http://bugs.java.com/bugdatabase/view_bug?bug_id=JDK-8340868).
ACTUAL -
Step 2: The window does not maximize.
Step 3: After setting the maxWidth and maxHeight to "Inf" and maximizing, the window will not unmaximize. Dragging the window before unmaximizing will workaround the issue, as will using the "Workaround" options to clear the minimum size restrictions.
---------- BEGIN SOURCE ----------
import javafx.application.Application;
import javafx.beans.binding.Bindings;
import javafx.beans.property.DoubleProperty;
import javafx.geometry.Insets;
import javafx.scene.Scene;
import javafx.scene.control.Label;
import javafx.scene.control.RadioButton;
import javafx.scene.control.ToggleGroup;
import javafx.scene.layout.HBox;
import javafx.scene.layout.VBox;
import javafx.stage.Stage;
public class HelloFX extends Application {
private Stage stage;
@Override
public void start(Stage stage) {
this.stage = stage;
String javaVersion = System.getProperty("java.version");
String javafxVersion = System.getProperty("javafx.version");
VBox layout = new VBox();
layout.setPadding(new Insets(10));
layout.setSpacing(20);
layout.getChildren().add(new Label("Hello, JavaFX " + javafxVersion + ", running on Java " + javaVersion + "."));
layout.getChildren().add(addPropertyTools(stage.minWidthProperty(), 0.0, 500.0, true));
layout.getChildren().add(addPropertyTools(stage.maxWidthProperty(), Double.MAX_VALUE, 700.0, false));
layout.getChildren().add(addPropertyTools(stage.minHeightProperty(), 0.0, 300.0, true));
layout.getChildren().add(addPropertyTools(stage.maxHeightProperty(), Double.MAX_VALUE, 500.0, false));
Scene scene = new Scene(layout, 600, 400);
stage.setScene(scene);
stage.show();
}
public static void main(String[] args) {
launch();
}
private HBox addPropertyTools(DoubleProperty property, double value1, double value2, boolean addWorkaround) {
HBox layout = new HBox();
layout.setSpacing(40);
layout.getChildren().add(new Label(property.getName() + ":"));
ToggleGroup toggleGroup = new ToggleGroup();
toggleGroup.selectedToggleProperty().addListener((obs, oldToggle, newToggle) -> {
((RadioButton)newToggle).getOnAction().handle(null); // handle non-click events that change the active toggle
});
addPropertyTool(property, value1, toggleGroup, layout);
addPropertyTool(property, value2, toggleGroup, layout).fire();
if (addWorkaround) {
RadioButton workaround = addPropertyTool(property, value2, toggleGroup, layout);
workaround.setText("Workaround");
workaround.setOnAction((event) -> property.bind(Bindings.when(stage.maximizedProperty()).then(0.0).otherwise(value2)));
}
return layout;
}
private RadioButton addPropertyTool(DoubleProperty property, double value, ToggleGroup toggleGroup, HBox layout) {
RadioButton option = new RadioButton(value == Double.MAX_VALUE ? "Inf" : String.valueOf(value));
option.setToggleGroup(toggleGroup);
option.setOnAction((event) -> {
property.unbind();
property.setValue(value);
});
layout.getChildren().add(option);
return option;
}
}
---------- END SOURCE ----------
CUSTOMER SUBMITTED WORKAROUND :
To work around being unable to unmaximize, the user can first drag the window when maximized, then unmaximize. A programmatic workaround for this is to remove the min size while the stage is maximized (included in the provided source code).
FREQUENCY : always
Red Hat 7.9
A DESCRIPTION OF THE PROBLEM :
If a stage has a max height or width set that is less than the screen width or height, maximizing the window does nothing. On Windows, it will maximize from the top left corner until a max is reached.
If a stage has a min height or width set, the window is shrunk down to that size, then maximized and unmaximized, unmaximizing does nothing.
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Using the provided source code:
1. Shrink the window size to the minimum size
2. Maximize the window
3. Unmaximize the window
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
Step 2: The window has the unmaximize button indicating it is maximized. The window moves to the top left corner and expands to the set max width and height
Step 3: The window has the maximize button indicating it is not maximized. The window returns to it's original position and size (http://bugs.java.com/bugdatabase/view_bug?bug_id=JDK-8340868).
ACTUAL -
Step 2: The window does not maximize.
Step 3: After setting the maxWidth and maxHeight to "Inf" and maximizing, the window will not unmaximize. Dragging the window before unmaximizing will workaround the issue, as will using the "Workaround" options to clear the minimum size restrictions.
---------- BEGIN SOURCE ----------
import javafx.application.Application;
import javafx.beans.binding.Bindings;
import javafx.beans.property.DoubleProperty;
import javafx.geometry.Insets;
import javafx.scene.Scene;
import javafx.scene.control.Label;
import javafx.scene.control.RadioButton;
import javafx.scene.control.ToggleGroup;
import javafx.scene.layout.HBox;
import javafx.scene.layout.VBox;
import javafx.stage.Stage;
public class HelloFX extends Application {
private Stage stage;
@Override
public void start(Stage stage) {
this.stage = stage;
String javaVersion = System.getProperty("java.version");
String javafxVersion = System.getProperty("javafx.version");
VBox layout = new VBox();
layout.setPadding(new Insets(10));
layout.setSpacing(20);
layout.getChildren().add(new Label("Hello, JavaFX " + javafxVersion + ", running on Java " + javaVersion + "."));
layout.getChildren().add(addPropertyTools(stage.minWidthProperty(), 0.0, 500.0, true));
layout.getChildren().add(addPropertyTools(stage.maxWidthProperty(), Double.MAX_VALUE, 700.0, false));
layout.getChildren().add(addPropertyTools(stage.minHeightProperty(), 0.0, 300.0, true));
layout.getChildren().add(addPropertyTools(stage.maxHeightProperty(), Double.MAX_VALUE, 500.0, false));
Scene scene = new Scene(layout, 600, 400);
stage.setScene(scene);
stage.show();
}
public static void main(String[] args) {
launch();
}
private HBox addPropertyTools(DoubleProperty property, double value1, double value2, boolean addWorkaround) {
HBox layout = new HBox();
layout.setSpacing(40);
layout.getChildren().add(new Label(property.getName() + ":"));
ToggleGroup toggleGroup = new ToggleGroup();
toggleGroup.selectedToggleProperty().addListener((obs, oldToggle, newToggle) -> {
((RadioButton)newToggle).getOnAction().handle(null); // handle non-click events that change the active toggle
});
addPropertyTool(property, value1, toggleGroup, layout);
addPropertyTool(property, value2, toggleGroup, layout).fire();
if (addWorkaround) {
RadioButton workaround = addPropertyTool(property, value2, toggleGroup, layout);
workaround.setText("Workaround");
workaround.setOnAction((event) -> property.bind(Bindings.when(stage.maximizedProperty()).then(0.0).otherwise(value2)));
}
return layout;
}
private RadioButton addPropertyTool(DoubleProperty property, double value, ToggleGroup toggleGroup, HBox layout) {
RadioButton option = new RadioButton(value == Double.MAX_VALUE ? "Inf" : String.valueOf(value));
option.setToggleGroup(toggleGroup);
option.setOnAction((event) -> {
property.unbind();
property.setValue(value);
});
layout.getChildren().add(option);
return option;
}
}
---------- END SOURCE ----------
CUSTOMER SUBMITTED WORKAROUND :
To work around being unable to unmaximize, the user can first drag the window when maximized, then unmaximize. A programmatic workaround for this is to remove the min size while the stage is maximized (included in the provided source code).
FREQUENCY : always
- relates to
-
JDK-8340868 Unmaximizing the window does not restore prior window position and size
-
- Closed
-