Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 3bb7d97

Browse files
committed
Fix SearchDialog ordering bug
1 parent 17cc4ab commit 3bb7d97

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

‎src/main/java/club/bytecode/the/jda/gui/search/SearchDialog.java‎

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ public class SearchDialog extends JDialog {
2121
private final List<ViewerFile> searchResults;
2222
private final JList<ViewerFile> list;
2323
private final JTextArea searchBox;
24+
private final ListModel<ViewerFile> listModel;
2425

2526
private String oldFilter = "";
2627

@@ -31,7 +32,8 @@ public SearchDialog(String needle, List<ViewerFile> matches) {
3132
pane.setPreferredSize(new Dimension(850, 400));
3233
pane.setLayout(new MigLayout("fill"));
3334
pane.add(new JLabel(needle + " found in:"), "pushx, growx, wrap");
34-
list = new JList<>(createSortedListModel());
35+
listModel = createSortedListModel();
36+
list = new JList<>(listModel);
3537
list.setSelectionMode(ListSelectionModel.SINGLE_INTERVAL_SELECTION);
3638
list.setLayoutOrientation(JList.VERTICAL);
3739

@@ -105,7 +107,7 @@ public void keyReleased(KeyEvent e) {
105107
}
106108

107109
public void openResult(int index) {
108-
ViewerFile vf = searchResults.get(index);
110+
ViewerFile vf = listModel.getElementAt(index);
109111
JDA.viewer.navigator.openClassFileToWorkSpace(vf);
110112
}
111113

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /