I am trying to force a JTextArea (and other text components through my application) to allow users to type RTL. This works correctly for input such as Arabic, but I must also be able to set it to apply this to standard text. Therefore, if I type "hello!" it will show up as "!olleh".
I have tried using the applyOrientation() method and setting the text area to have RTL like so:
jTextPane1.getDocument().putProperty(
TextAttribute.RUN_DIRECTION,
TextAttribute.RUN_DIRECTION_RTL);
I have had no success thus far. It has been suggested that I try the Bidi libraries, but these seem focused on interpretation of text which is already bidirectional. When I apply the above, I get right justified text, but it remains LTR in terms of the character order. Is there anything that I'm missing here? Is there a way to set the value that Java itself checks when looking for which direction text entry should move the carat?