Skip to content

Text Area's node orientation doesn't reflect on text when updated from an accelerator. #86

@Moubassher

Description

@Moubassher
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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions