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
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