Skip to content

Commit

Permalink
feat: add focus to preferred components in Quarkus wizard
Browse files Browse the repository at this point in the history
Signed-off-by: Fred Bricon <[email protected]>
  • Loading branch information
fbricon committed Nov 14, 2023
1 parent 75c5e7e commit 3b3c394
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ public class QuarkusExtensionsStep extends ModuleWizardStep implements Disposabl

private JPanel outerPanel;
private final WizardContext wizardContext;
private SearchTextField filter;

private static class ExtensionsTreeCellRenderer extends CheckboxTree.CheckboxTreeCellRenderer {

Expand Down Expand Up @@ -135,7 +136,7 @@ public JComponent getComponent() {
JLabel label1 = new JLabel("Filter extensions");
label1.setAlignmentX(Component.LEFT_ALIGNMENT);
panel.add(label1);
SearchTextField filter = new SearchTextField() {
filter = new SearchTextField() {
@Override
public Dimension getMaximumSize() {
Dimension maxSize = super.getMaximumSize();
Expand Down Expand Up @@ -223,6 +224,12 @@ public void valueChanged(TreeSelectionEvent e) {
return outerPanel;
}


@Override
public JComponent getPreferredFocusedComponent() {
return filter;
}

private KeyListener onSelectedExtensionsKeyPressed(List<QuarkusCategory> categories, CheckboxTree extensionsTree, JList<QuarkusExtension> selectedExtensions) {
return new KeyAdapter() {
@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,11 @@ protected void customizeCellRenderer(@NotNull JList<? extends BuildToolDelegate>
isInitialized = true;
}

@Override
public JComponent getPreferredFocusedComponent() {
return toolComboBox;
}

private Future<QuarkusExtensionsModel> loadExtensionsModel(CollectionComboBoxModel<QuarkusStream> streamModel, ProgressIndicator indicator) {
String key = ((QuarkusStream) streamModel.getSelectedItem()).getKey();
if (key == null) {
Expand Down

0 comments on commit 3b3c394

Please sign in to comment.