List of usage examples for javafx.scene.input KeyEvent KeyEvent
public KeyEvent(@NamedArg("source") Object source, @NamedArg("target") EventTarget target, @NamedArg("eventType") EventType<KeyEvent> eventType, @NamedArg("character") String character, @NamedArg("text") String text, @NamedArg("code") KeyCode code, @NamedArg("shiftDown") boolean shiftDown, @NamedArg("controlDown") boolean controlDown, @NamedArg("altDown") boolean altDown, @NamedArg("metaDown") boolean metaDown)
From source file:com.hengyi.japp.print.client.controller.MdController.java
@FXML private void autoCompleteSapMara(KeyEvent ev) { try {/*w w w. j av a2 s . c o m*/ if (KeyCode.RIGHT.equals(ev.getCode())) { List<SapMara> sapMaras = md.getSapT001().autoCompleteSapMara(matnrField.getText()); sapMaraListView.setItems(observableArrayList(sapMaras)); sapMaraListView.setVisible(true); sapMaraListView.getSelectionModel().selectFirst(); } else if (KeyCode.UP.equals(ev.getCode()) || KeyCode.DOWN.equals(ev.getCode())) { sapMaraListView.fireEvent(new KeyEvent(null, sapMaraListView, KeyEvent.KEY_PRESSED, ev.getCharacter(), ev.getText(), ev.getCode(), false, false, false, false)); } else if (KeyCode.ENTER.equals(ev.getCode())) { selectSapMara(sapMaraListView.getSelectionModel().getSelectedItem()); sapMaraListView.setVisible(false); } } catch (Exception ex) { Util.alertDialog(ex); } }