File tree Expand file tree Collapse file tree 1 file changed +4
-2
lines changed
src/main/java/club/bytecode/the/jda/gui/search Expand file tree Collapse file tree 1 file changed +4
-2
lines changed Original file line number Diff line number Diff 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
You can’t perform that action at this time.
0 commit comments