最初の例ではおかしなことに聞こえるかもしれませんが:)TextArea.LEFT問題を解決するために配置を設定すると、調整されRIGHTます!
Form form = new Form();
TextArea textArea = new TextArea("Some Arabic text ...");
textArea.setRTL(true);
textArea.setAlignment(TextArea.LEFT);
form.addComponent(textArea);
LEFT表示されるテキストをRIGHT揃えるように設定します。
またはtextArea.setRTL(true)、ディスプレイをミラーリングしているを削除することによって
Form form = new Form();
TextArea textArea = new TextArea("Some Arabic text ...");
textArea.setAlignment(TextArea.RIGHT);
form.addComponent(textArea);
RTLに設定されている場合に、より複雑な詳細に関心がある場合:クラス
のpaintメソッドは次のとおりです。TextArea
public void paint(Graphics g) {
UIManager.getInstance().getLookAndFeel().drawTextArea(g, this);
}
そして、drawTextAreaの方法DefaultLookAndFeelは次のとおりです。
int align = ta.getAbsoluteAlignment();
// remaining code is here in initial source
switch(align) {
case Component.RIGHT:
x = ta.getX() + ta.getWidth() - rightPadding - f.stringWidth(displayText);
break;
// remaining code is here in initial source
}
g.drawString(displayText, x, y);
残念ながら、TextArea.RIGHT値は3ですが
、呼び出すta.getAbsoluteAlignment()と1が返されます(オブジェクトの配置はコードによってTextArea.RIGHT!!に設定されています)
一方、TextArea.Left値は1
です。そのため、スイッチの値と一致し、RIGHT
ところで、あなたが設定した場合
textArea.setAlignment(Component.RIGHT);
Component.RIGHTペイントメソッドの外側の値は1ではなく3であるため、これも間違っています。