Skip to content

Commit 449acbc

Browse files
authored
feat: 优化InputDialogPane体验 (#5032)
1 parent 1c82e4e commit 449acbc

1 file changed

Lines changed: 7 additions & 1 deletion

File tree

HMCL/src/main/java/org/jackhuang/hmcl/ui/construct/InputDialogPane.java

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
import static org.jackhuang.hmcl.ui.FXUtils.onEscPressed;
3131
import static org.jackhuang.hmcl.util.i18n.I18n.i18n;
3232

33-
public class InputDialogPane extends JFXDialogLayout {
33+
public class InputDialogPane extends JFXDialogLayout implements DialogAware {
3434
private final CompletableFuture<String> future = new CompletableFuture<>();
3535

3636
private final JFXTextField textField;
@@ -70,9 +70,15 @@ public InputDialogPane(String text, String initialValue, FutureCallback<String>
7070
});
7171
});
7272

73+
textField.setOnAction(event -> acceptButton.fire());
7374
onEscPressed(this, cancelButton::fire);
7475
}
7576

77+
@Override
78+
public void onDialogShown() {
79+
textField.requestFocus();
80+
}
81+
7682
public CompletableFuture<String> getCompletableFuture() {
7783
return future;
7884
}

0 commit comments

Comments
 (0)