I want to align the text in a TextArea to the right. I tried the following code:
Form form = new Form();
TextArea textArea = new TextArea("Some Arabic text ...");
textArea.setRTL(true);
textArea.setAlignment(RIGHT);
form.addComponent(textArea);
The result was just moving the scroll to left,
But the text is still not aligned RIGHT,
check the image below:

So how to align the content to the RIGHT ?
It may sound crazy for the first instance :) but setting the alignment to
TextArea.LEFTsolved the issue and now it'sRIGHTaligned !Setting it to
LEFTmakes the displayed textRIGHTaligned !Or by removing the
textArea.setRTL(true)which is mirroring the displayFor those who are interested in more complicated details when it's set to RTL:
the
paintmethod ofTextAreaclass isAnd
drawTextAreamethod inDefaultLookAndFeelis as follows:Unfortunately
TextArea.RIGHTvalue is 3But when calling
ta.getAbsoluteAlignment()it returns 1 (despite that the object's alignment is set by code toTextArea.RIGHT!!)Meanwhile
TextArea.Leftvalue is 1That's why it matched the value in the switch and was aligned to
RIGHTBTW, if you set
it will also be wrong, because
Component.RIGHToutside the paint method has the value 3 not 1 !