Hi, I would like to know how to go to a new line in a text area when a key combination of Shift+Enter is pressed. (Pressing enter itself causes the text to be cleared and sent off to an ObservableList). Here's what I was trying:
text.setOnKeyReleased(new EventHandler<KeyEvent>() {
final KeyCombination comb1 = new KeyCodeCombination(KeyCode.ENTER, KeyCombination.SHIFT_DOWN);
final KeyCombination comb2 = new KeyCodeCombination(KeyCode.ENTER);
public void handle(KeyEvent t) {
if (comb2.match(t) && !comb1.match(t)) {
obs.addAll(text.getText());
text.clear();
}
}
});
I'm not aware of any explicit function which allows the caret position to position itself to a new line.