List of usage examples for javafx.scene.input KeyCode F10
KeyCode F10
To view the source code for javafx.scene.input KeyCode F10.
Click Source Link
From source file:com.panemu.tiwulfx.control.skin.LookupFieldSkin.java
public LookupFieldSkin(LookupField<T> control) { super(control, new LookupFieldBehavior<>(control)); this.lookupField = control; // move focus in to the textfield lookupField.focusedProperty().addListener(new ChangeListener<Boolean>() { @Override//from w w w.j a v a 2s . co m public void changed(ObservableValue<? extends Boolean> ov, Boolean t, Boolean hasFocus) { if (hasFocus) { Platform.runLater(new Runnable() { @Override public void run() { textField.requestFocus(); } }); } } }); initialize(); textField.focusedProperty().addListener(new ChangeListener<Boolean>() { @Override public void changed(ObservableValue<? extends Boolean> ov, Boolean t, Boolean hasFocus) { if (!hasFocus) { validate(); } } }); lookupField.addEventFilter(InputEvent.ANY, new EventHandler<InputEvent>() { @Override public void handle(InputEvent t) { if (textField == null) { return; } // When the user hits the enter or F4 keys, we respond before // ever giving the event to the TextField. if (t instanceof KeyEvent) { KeyEvent ke = (KeyEvent) t; if ((ke.getCode() == KeyCode.F10 || ke.getCode() == KeyCode.ESCAPE || ke.getCode() == KeyCode.ENTER) && !ke.isControlDown()) { // RT-23275: The TextField fires F10 and ESCAPE key events // up to the parent, which are then fired back at the // TextField, and this ends up in an infinite loop until // the stack overflows. So, here we consume these two // events and stop them from going any further. t.consume(); return; } } } }); textField.promptTextProperty().bind(lookupField.promptTextProperty()); getSkinnable().requestLayout(); registerChangeListener(control.showingSuggestionProperty(), PROP_SHOWING_SUGGESTION); registerChangeListener(control.showingLookupDialogProperty(), PROP_SHOWING_LOOKUP_WINDOW); registerChangeListener(control.resettingDisplayTextProperty(), PROP_RESETTING_DISPLAY_TEXT); }