Browse Source

enter键问题

master
XiaXiang 7 years ago
parent
commit
6300044d73
  1. 10
      designer/src/com/fr/design/mainframe/alphafine/component/AlphaFineDialog.java

10
designer/src/com/fr/design/mainframe/alphafine/component/AlphaFineDialog.java

@ -676,7 +676,7 @@ public class AlphaFineDialog extends UIDialog {
searchResultList.setSelectedIndex(searchResultList.getSelectedIndex() + 1); searchResultList.setSelectedIndex(searchResultList.getSelectedIndex() + 1);
} else if (e.getKeyCode() == KeyEvent.VK_UP) { } else if (e.getKeyCode() == KeyEvent.VK_UP) {
searchResultList.setSelectedIndex(searchResultList.getSelectedIndex() - 1); searchResultList.setSelectedIndex(searchResultList.getSelectedIndex() - 1);
} else escAlphaFine(e); } else escAlphaFineDialog(e);
} }
}); });
@ -888,7 +888,7 @@ public class AlphaFineDialog extends UIDialog {
* *
* @param e * @param e
*/ */
private void escAlphaFine(KeyEvent e) { private void escAlphaFineDialog(KeyEvent e) {
if (e.getKeyCode() == KeyEvent.VK_ESCAPE) { if (e.getKeyCode() == KeyEvent.VK_ESCAPE) {
if (StringUtils.isBlank(searchTextField.getText()) || ComparatorUtils.equals(searchTextField.getText(), searchTextField.getPlaceHolder())) { if (StringUtils.isBlank(searchTextField.getText()) || ComparatorUtils.equals(searchTextField.getText(), searchTextField.getPlaceHolder())) {
AlphaFineDialog.this.setVisible(false); AlphaFineDialog.this.setVisible(false);
@ -896,6 +896,10 @@ public class AlphaFineDialog extends UIDialog {
searchTextField.setText(null); searchTextField.setText(null);
removeSearchResult(); removeSearchResult();
} }
} else if (e.getKeyCode() == KeyEvent.VK_ENTER) {
if (searchResultList.getModel().getSize() > 1) {
dealWithSearchResult(searchResultList.getSelectedValue());
}
} }
} }
@ -969,7 +973,7 @@ public class AlphaFineDialog extends UIDialog {
addKeyListener(new KeyAdapter() { addKeyListener(new KeyAdapter() {
@Override @Override
public void keyPressed(KeyEvent e) { public void keyPressed(KeyEvent e) {
escAlphaFine(e); escAlphaFineDialog(e);
} }
}); });

Loading…
Cancel
Save