KeyCombination rtlShortcut = new KeyCodeCombination(KeyCode.R, KeyCombination.CONTROL_ANY);
Runnable RTLrunnable = () -> {
Platform.runLater(() -> {
optionTA.setNodeOrientation(NodeOrientation.RIGHT_TO_LEFT);
});
System.out.println("optionTA's node orientation: " + optionTA.getNodeOrientation());
};
KeyboardShortcuts.getInstance().addKeyboardShortcut(rtlShortcut,RTLrunnable);
The print statement shows the optionTA's node orientation does change, but the text doesn't reflect so. When I use a choice box that's next to the text area, it does change:
textDirectionCB.getItems().addAll(NodeOrientation.LEFT_TO_RIGHT, NodeOrientation.RIGHT_TO_LEFT);
onOrientationChanged(optionTA::setNodeOrientation);
private void onOrientationChanged(Consumer<NodeOrientation> orientationChangeFunc) {
textDirectionCB.getSelectionModel().selectedItemProperty()
.addListener((a, b, selectedOrientation) ->
orientationChangeFunc.accept(selectedOrientation));
}
Whether I make sure the code is run from the UI thread or not by calling Platform.runLater(...), nothing changes.
The print statement shows the optionTA's node orientation does change, but the text doesn't reflect so. When I use a choice box that's next to the text area, it does change:
Whether I make sure the code is run from the UI thread or not by calling Platform.runLater(...), nothing changes.