Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8145515

addEventFilter for combobox editor does not react on key action enter

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P3 P3
    • 9
    • 8u66, 9
    • javafx
    • x86_64
    • linux

      FULL PRODUCT VERSION :


      ADDITIONAL OS VERSION INFORMATION :
      3.11-2-amd64 #1 SMP Debian 3.11.8-1 (2013-11-13) x86_64 GNU/Linux


      A DESCRIPTION OF THE PROBLEM :
      Im using an ComboBox which has an added KeyPressEventFilter . When the user press enter while the focus is on the combobox, the if (e.getCode() == KeyCode.ENTER) condition should be true and some logic should be executed. Which was working on jdk 1.8_45 but in the newer releases the listener does not react on the key enter(other keys are working).

      REGRESSION. Last worked in version 8u45

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      - Declare and initialize a ComboBox

      - Add on the editor of the ComboBox an EventFilter for KeyEvent.Key_Pressed( comboBoxSearchResults.getEditor().addEventFilter(KeyEvent.KEY_PRESSED, (KeyEvent e) -> {)

      -Focus the ComboBox and press enter


      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      The logic which is implemented in the EventFilter should be executed
      ACTUAL -
      The logic will be not executed because the EventFilter does not catch the enter key press

      REPRODUCIBILITY :
      This bug can be reproduced always.

      ---------- BEGIN SOURCE ----------
      ComboBox<SearchResult> comboBoxSearchResults;
      comboBoxSearchResults.setItems(searchResults);
      comboBoxSearchResults.setConverter(new SearchResultStringConverter(searchResults));
      comboBoxSearchResults.getEditor().addEventFilter(KeyEvent.KEY_PRESSED, (KeyEvent e) -> {
                  if (e.getCode() == KeyCode.ENTER) {
                
                          //some logic
                  }

              });
      ---------- END SOURCE ----------

            jgiles Jonathan Giles
            webbuggrp Webbug Group
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:
              Resolved: