How do I make hitting the Tab Key in TextArea navigates to the next control ?
I could add a listener to cath de key pressed event, but how do I make te TextArea control
I use the traverse-methods
@Override
public void handle(KeyEvent event) {
if (event.getCode().equals(KeyCode.TAB)) {
Node node = (Node) event.getSource();
if (node instanceof TextField) {
TextFieldSkin skin = (TextFieldSkin) ((TextField)node).getSkin();
if (event.isShiftDown()) {
skin.getBehavior().traversePrevious();
}
else {
skin.getBehavior().traverseNext();
}
}
else if (node instanceof TextArea) {
TextAreaSkin skin = (TextAreaSkin) ((TextArea)node).getSkin();
if (event.isShiftDown()) {
skin.getBehavior().traversePrevious();
}
else {
skin.getBehavior().traverseNext();
}
}
event.consume();
}
}