diff --git a/designer/src/com/fr/design/mainframe/alphafine/component/AlphaFineDialog.java b/designer/src/com/fr/design/mainframe/alphafine/component/AlphaFineDialog.java index daab6961f..90911640a 100644 --- a/designer/src/com/fr/design/mainframe/alphafine/component/AlphaFineDialog.java +++ b/designer/src/com/fr/design/mainframe/alphafine/component/AlphaFineDialog.java @@ -587,9 +587,8 @@ public class AlphaFineDialog extends UIDialog { searchTextField.addKeyListener(new KeyAdapter() { @Override public void keyPressed(KeyEvent e) { - if (e.getKeyCode() == KeyEvent.VK_DOWN && searchTextField.hasFocus()) { + if (e.getKeyCode() == KeyEvent.VK_DOWN) { searchResultList.requestFocus(); - searchResultList.setSelectedIndex(searchResultList.getSelectedIndex() + 1); } } }); @@ -836,10 +835,6 @@ public class AlphaFineDialog extends UIDialog { } private void initListListener() { - - /** - * 为list添加键盘监听器 - */ addKeyListener(new KeyAdapter() { @Override public void keyPressed(KeyEvent e) { @@ -854,9 +849,6 @@ public class AlphaFineDialog extends UIDialog { } }); - /** - * 为list添加鼠标监听器 - */ addMouseListener(new MouseAdapter() { @Override public void mouseClicked(MouseEvent e) { @@ -873,21 +865,22 @@ public class AlphaFineDialog extends UIDialog { } }); - /** - *单击时触发右侧面板展示搜索结果 - */ addListSelectionListener(new ListSelectionListener() { @Override public void valueChanged(ListSelectionEvent e) { if (!e.getValueIsAdjusting() && getSelectedValue() != null) { showResult(getSelectedValue()); - } } }); - } - + addFocusListener(new FocusAdapter() { + @Override + public void focusGained(FocusEvent e) { + setSelectedIndex(searchResultList.getSelectedIndex() + 1); + } + }); + } } /** diff --git a/designer/src/com/fr/design/mainframe/alphafine/search/manager/RecentSearchManager.java b/designer/src/com/fr/design/mainframe/alphafine/search/manager/RecentSearchManager.java index 16de73fc0..1b6b2b658 100644 --- a/designer/src/com/fr/design/mainframe/alphafine/search/manager/RecentSearchManager.java +++ b/designer/src/com/fr/design/mainframe/alphafine/search/manager/RecentSearchManager.java @@ -230,7 +230,9 @@ public class RecentSearchManager extends XMLFileManager implements AlphaFineSear Collections.sort(resultModelList); int size = resultModelList.size(); if (size > MAX_SIZE) { - return (SearchResult) resultModelList.subList(0, MAX_SIZE); + SearchResult result = new SearchResult(); + result.addAll(resultModelList.subList(0, MAX_SIZE)); + return result; } return resultModelList; }