-
Enhancement
-
Resolution: Fixed
-
P4
-
8
In ComboBoxListViewSkin there is an event filter which begins like this:
comboBox.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) {
This registers filter to all existing input events and than does instanceof to only filter key events. This is ineffective and ugly. The filter should be only registered to events it wants to process. You should replace InputEvent.ANY by KeyEvent.ANY, handle KeyEvents only and get rid of the instanceof check and cast.
comboBox.addEventFilter(KeyEvent.ANY, new EventHandler<KeyEvent>() {
@Override public void handle(KeyEvent ke) {
comboBox.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) {
This registers filter to all existing input events and than does instanceof to only filter key events. This is ineffective and ugly. The filter should be only registered to events it wants to process. You should replace InputEvent.ANY by KeyEvent.ANY, handle KeyEvents only and get rid of the instanceof check and cast.
comboBox.addEventFilter(KeyEvent.ANY, new EventHandler<KeyEvent>() {
@Override public void handle(KeyEvent ke) {