-
Bug
-
Resolution: Unresolved
-
P3
-
jfx11, 8, 9, 10
-
x86_64
-
generic
ADDITIONAL SYSTEM INFORMATION :
Using Windows 10. Not tested in other OS.
A DESCRIPTION OF THE PROBLEM :
When there are two (or more) GridPane columns containing ComboBoxes (or any other controls using PopupControl), and that the ComboBoxes' HGrow are set ALWAYS, opening and closing any of the popups causes the whole GridPane to be resized. This only happens when the layout is not in a default calculated size.
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
1. Run the sample code.
2. The application will show 2 ComboBoxes on a single row. They will have the same width.
3. Resize the program, either by resizing the window or by maximizing the window. The 2 ComboBoxes will continue to grow and have the same width.
4. Click on either of the 2 ComboBoxes.
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
The ComboBoxes will not be resized and are expected to have the same width.
ACTUAL -
One of the ComboBoxes is resized.
---------- BEGIN SOURCE ----------
import javafx.application.Application;
import javafx.collections.FXCollections;
import javafx.collections.ObservableList;
import javafx.scene.Scene;
import javafx.scene.control.ComboBox;
import javafx.scene.control.Label;
import javafx.scene.layout.GridPane;
import javafx.scene.layout.Priority;
import javafx.stage.Stage;
public class testFX extends Application {
@Override
public void start(final Stage primaryStage) throws Exception {
final ObservableList<String> fruits = FXCollections.observableArrayList("Apple", "Banana", "Pineapple",
"Some kind of fruit that has a very very long name");
final GridPane root = new GridPane();
root.setMaxSize(Double.MAX_VALUE, Double.MAX_VALUE);
root.setPrefSize(GridPane.USE_COMPUTED_SIZE, GridPane.USE_COMPUTED_SIZE);
final Label label1 = new Label("Test");
final ComboBox<String> combo1 = new ComboBox<>(fruits);
combo1.setMaxWidth(Double.MAX_VALUE);
GridPane.setHgrow(label1, Priority.SOMETIMES);
GridPane.setHgrow(combo1, Priority.ALWAYS);
final Label label2 = new Label("Test");
final ComboBox<String> combo2 = new ComboBox<>(fruits);
combo2.setMaxWidth(Double.MAX_VALUE);
GridPane.setHgrow(label2, Priority.SOMETIMES);
GridPane.setHgrow(combo2, Priority.ALWAYS);
root.addRow(0, label1, combo1, label2, combo2);
final Scene sc = new Scene(root);
primaryStage.setScene(sc);
primaryStage.show();
}
public static void main(final String[] args) {
Application.launch(args);
}
}
---------- END SOURCE ----------
FREQUENCY : always
Using Windows 10. Not tested in other OS.
A DESCRIPTION OF THE PROBLEM :
When there are two (or more) GridPane columns containing ComboBoxes (or any other controls using PopupControl), and that the ComboBoxes' HGrow are set ALWAYS, opening and closing any of the popups causes the whole GridPane to be resized. This only happens when the layout is not in a default calculated size.
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
1. Run the sample code.
2. The application will show 2 ComboBoxes on a single row. They will have the same width.
3. Resize the program, either by resizing the window or by maximizing the window. The 2 ComboBoxes will continue to grow and have the same width.
4. Click on either of the 2 ComboBoxes.
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
The ComboBoxes will not be resized and are expected to have the same width.
ACTUAL -
One of the ComboBoxes is resized.
---------- BEGIN SOURCE ----------
import javafx.application.Application;
import javafx.collections.FXCollections;
import javafx.collections.ObservableList;
import javafx.scene.Scene;
import javafx.scene.control.ComboBox;
import javafx.scene.control.Label;
import javafx.scene.layout.GridPane;
import javafx.scene.layout.Priority;
import javafx.stage.Stage;
public class testFX extends Application {
@Override
public void start(final Stage primaryStage) throws Exception {
final ObservableList<String> fruits = FXCollections.observableArrayList("Apple", "Banana", "Pineapple",
"Some kind of fruit that has a very very long name");
final GridPane root = new GridPane();
root.setMaxSize(Double.MAX_VALUE, Double.MAX_VALUE);
root.setPrefSize(GridPane.USE_COMPUTED_SIZE, GridPane.USE_COMPUTED_SIZE);
final Label label1 = new Label("Test");
final ComboBox<String> combo1 = new ComboBox<>(fruits);
combo1.setMaxWidth(Double.MAX_VALUE);
GridPane.setHgrow(label1, Priority.SOMETIMES);
GridPane.setHgrow(combo1, Priority.ALWAYS);
final Label label2 = new Label("Test");
final ComboBox<String> combo2 = new ComboBox<>(fruits);
combo2.setMaxWidth(Double.MAX_VALUE);
GridPane.setHgrow(label2, Priority.SOMETIMES);
GridPane.setHgrow(combo2, Priority.ALWAYS);
root.addRow(0, label1, combo1, label2, combo2);
final Scene sc = new Scene(root);
primaryStage.setScene(sc);
primaryStage.show();
}
public static void main(final String[] args) {
Application.launch(args);
}
}
---------- END SOURCE ----------
FREQUENCY : always