ComboBox setOnKeyPressed() not working for Enter Key

XMLWordPrintable

    • Type: Bug
    • Resolution: Cannot Reproduce
    • Priority: P4
    • 8
    • Affects Version/s: 7u15
    • Component/s: javafx
    • Environment:

      Win XP 32/64, Windows-7 32/64 and Mac OSX

      I am using the following code

      libraryCombo.setOnKeyPressed(new EventHandler<KeyEvent>(){
                  @Override
                  public void handle(KeyEvent t) {
                      if (t.getCode() == KeyCode.ENTER) {
                          btn_OkAction.requestFocus();
                          makeOKAction(null);
                      }
                  }
              });

      Where libraryCombo is the object of ComboBox

      But this code is not working for Enter Key but for Other Keys it os working properly.

      I also tried this but has the same behavior

      libraryCombo.getEditor().addEventHandler(KeyEvent.KEY_PRESSED, new EventHandler<KeyEvent>(){
                  @Override
                  public void handle(KeyEvent t) {
                      if (t.getCode() == KeyCode.ENTER) {
                          btn_OkAction.requestFocus();
                          makeOKAction(null);
                      }
                  }
              });

      Please have a look.

      Thanks



            Assignee:
            Jonathan Giles
            Reporter:
            Rahul (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported: