fix(ui): refine PromptDialogPane (#3693)

- Limit the dialog width to avoid too long a width
- Avoid accidental blank line in the information box (That blue bg box)
This commit is contained in:
3gf8jv4dv 2025-06-06 21:56:40 +08:00 committed by GitHub
parent 24bb630afa
commit d9d32eab1d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -49,6 +49,7 @@ public class PromptDialogPane extends DialogPane {
public PromptDialogPane(Builder builder) { public PromptDialogPane(Builder builder) {
this.builder = builder; this.builder = builder;
setTitle(builder.title); setTitle(builder.title);
setPrefWidth(560);
GridPane body = new GridPane(); GridPane body = new GridPane();
body.setVgap(8); body.setVgap(8);
@ -72,13 +73,13 @@ public class PromptDialogPane extends DialogPane {
if (StringUtils.isNotBlank(question.question.get())) { if (StringUtils.isNotBlank(question.question.get())) {
body.addRow(rowIndex++, new Label(question.question.get()), textField); body.addRow(rowIndex++, new Label(question.question.get()), textField);
} else { } else {
GridPane.setColumnSpan(textField, 2); GridPane.setColumnSpan(textField, 1);
body.addRow(rowIndex++, textField); body.addRow(rowIndex++, textField);
} }
GridPane.setMargin(textField, new Insets(0, 0, 20, 0)); GridPane.setMargin(textField, new Insets(0, 0, 20, 0));
} else if (question instanceof Builder.BooleanQuestion) { } else if (question instanceof Builder.BooleanQuestion) {
HBox hBox = new HBox(); HBox hBox = new HBox();
GridPane.setColumnSpan(hBox, 2); GridPane.setColumnSpan(hBox, 1);
JFXCheckBox checkBox = new JFXCheckBox(); JFXCheckBox checkBox = new JFXCheckBox();
hBox.getChildren().setAll(checkBox); hBox.getChildren().setAll(checkBox);
HBox.setMargin(checkBox, new Insets(0, 0, 0, -10)); HBox.setMargin(checkBox, new Insets(0, 0, 0, -10));
@ -95,12 +96,12 @@ public class PromptDialogPane extends DialogPane {
if (StringUtils.isNotBlank(question.question.get())) { if (StringUtils.isNotBlank(question.question.get())) {
body.addRow(rowIndex++, new Label(question.question.get()), comboBox); body.addRow(rowIndex++, new Label(question.question.get()), comboBox);
} else { } else {
GridPane.setColumnSpan(comboBox, 2); GridPane.setColumnSpan(comboBox, 1);
body.addRow(rowIndex++, comboBox); body.addRow(rowIndex++, comboBox);
} }
} else if (question instanceof Builder.HintQuestion) { } else if (question instanceof Builder.HintQuestion) {
HintPane pane = new HintPane(); HintPane pane = new HintPane();
GridPane.setColumnSpan(pane, 2); GridPane.setColumnSpan(pane, 1);
pane.textProperty().bind(question.question); pane.textProperty().bind(question.question);
body.addRow(rowIndex++, pane); body.addRow(rowIndex++, pane);
} }