How do I get a choicebox in JavaFX to pass focus to the next element when I press tab?
I’ve tried setting the focus traversable to true but that didn’t appear to do anything.
cbSoils.setFocusTraversable(true);
I’ve tried setting the key press or release to change focus but it is triggered when I tab TO the choicebox from the previous element.
cbSoils.setOnKeyReleased(new EventHandler<KeyEvent>() {
@Override
public void handle(KeyEvent event) {
// On tab press send the focus to tfAddress
if(event.getCode() == KeyCode.TAB){
tfAddress.requestFocus();
}
}
});
Anyone have a better idea?
Which version of FX do you use? I’ve tested with JavaFX 2.1 b18 and ChoiceBox passes focus on Tab clicks in next code: