A DESCRIPTION OF THE PROBLEM :
Initially a choice dialog with expandable content works as expected when the content is expanded/hidden. The dialog grows and shrinks in both the x & y directions. Once the combo box has been clicked, when the content is expanded then hidden the dialog remains expanded in the x direction.
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Any choice dialog with expandable content
---------- BEGIN SOURCE ----------
public class DialogBugDemo extends Application {
@Override
public void start(Stage primaryStage) throws Exception {
Button showDialog = new Button("Show Dialog");
showDialog.setOnAction(e -> {
var cd = getChoiceDialog();
cd.showAndWait();
});
Scene scene = new Scene(new FlowPane(showDialog), 200, 100);
primaryStage.setScene(scene);
primaryStage.show();
}
private ChoiceDialog<String> getChoiceDialog() {
ChoiceDialog<String> cd = new ChoiceDialog<String>(null, "One", "Two", "Three");
// @formatter:off
StringBuffer buf = new StringBuffer()
.append("Some new text that wraps around the textarea and demonstrates the expandable bug ")
.append("Some new text that wraps around the textarea and demonstrates the expandable bug ")
.append("Some new text that wraps around the textarea and demonstrates the expandable bug ")
.append("Some new text that wraps around the textarea and demonstrates the expandable bug ")
.append("Some new text that wraps around the textarea and demonstrates the expandable bug ")
.append("Some new text that wraps around the textarea and demonstrates the expandable bug ");
// @formatter:on
TextArea ta = new TextArea();
ta.setText(buf.toString());
ta.setEditable(false);
ta.setWrapText(true);
// Initially the dialog works as expected when
// the expandable content is expanded/hidden.
// The dialog expands horizontally and vertically
// when expanded and shrinks in both axis' when hidden.
// Once the combo box has been clicked, after
// expanding/hiding the dialog remains at the
// expanded width.
cd.getDialogPane().setExpandableContent(ta);
return cd;
}
public static void main(String... args) {
Application.launch(DialogBugDemo.class, args);
}
}
---------- END SOURCE ----------
FREQUENCY : always
Also, related issue: the ChoiceDialog ignores maxWidth constraint on the Node set via its .getDialogPane().setExpandableContent() - see the comment below.
Initially a choice dialog with expandable content works as expected when the content is expanded/hidden. The dialog grows and shrinks in both the x & y directions. Once the combo box has been clicked, when the content is expanded then hidden the dialog remains expanded in the x direction.
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Any choice dialog with expandable content
---------- BEGIN SOURCE ----------
public class DialogBugDemo extends Application {
@Override
public void start(Stage primaryStage) throws Exception {
Button showDialog = new Button("Show Dialog");
showDialog.setOnAction(e -> {
var cd = getChoiceDialog();
cd.showAndWait();
});
Scene scene = new Scene(new FlowPane(showDialog), 200, 100);
primaryStage.setScene(scene);
primaryStage.show();
}
private ChoiceDialog<String> getChoiceDialog() {
ChoiceDialog<String> cd = new ChoiceDialog<String>(null, "One", "Two", "Three");
// @formatter:off
StringBuffer buf = new StringBuffer()
.append("Some new text that wraps around the textarea and demonstrates the expandable bug ")
.append("Some new text that wraps around the textarea and demonstrates the expandable bug ")
.append("Some new text that wraps around the textarea and demonstrates the expandable bug ")
.append("Some new text that wraps around the textarea and demonstrates the expandable bug ")
.append("Some new text that wraps around the textarea and demonstrates the expandable bug ")
.append("Some new text that wraps around the textarea and demonstrates the expandable bug ");
// @formatter:on
TextArea ta = new TextArea();
ta.setText(buf.toString());
ta.setEditable(false);
ta.setWrapText(true);
// Initially the dialog works as expected when
// the expandable content is expanded/hidden.
// The dialog expands horizontally and vertically
// when expanded and shrinks in both axis' when hidden.
// Once the combo box has been clicked, after
// expanding/hiding the dialog remains at the
// expanded width.
cd.getDialogPane().setExpandableContent(ta);
return cd;
}
public static void main(String... args) {
Application.launch(DialogBugDemo.class, args);
}
}
---------- END SOURCE ----------
FREQUENCY : always
Also, related issue: the ChoiceDialog ignores maxWidth constraint on the Node set via its .getDialogPane().setExpandableContent() - see the comment below.