title: How to set the orientation of JTextArea from right to left (inside JOptionPane)
body: <p>I have <code>JScrollPane</code> with <code>JTextArea</code> inside it and I am trying to set the JTextArea's orientation from right to left so the text inside it will start from the right and the scrollbar will be on the left</p>
  
  <p>I've tried the following but they didn't affect the direction of the orientation:</p>
  
  <pre><code>txt.applyComponentOrientation(ComponentOrientation.RIGHT_TO_LEFT);
  txt.setComponentOrientation(ComponentOrientation.RIGHT_TO_LEFT);
  txt.setAlignmentX(JTextArea.RIGHT_ALIGNMENT);
  </code></pre>
  
  <p><strong>EDIT:</strong></p>
  
  <p>the two answers camickr &amp; trashgod provided work fine but not in my program where I use my JTextArea as an object Message and pass it to OptionPane.</p>
  
  <p><strong>EDIT2:</strong></p>
  
  <p>I figured out that <code>setComponentOrientation(ComponentOrientation.RIGHT_TO_LEFT);</code> doesn't work if I apply it on the JOptionPane contents .. is there an alternative solution to this issue?</p>
  
  <p>Similar to my code:</p>
  
  <pre><code>import java.awt.*;
  import java.util.*;
  import javax.swing.*;
  public class TextArea extends JPanel
  {
      private JTextArea txt = new JTextArea();
      public TextArea()
      {
          setLayout(new GridLayout());
          txt.setComponentOrientation(ComponentOrientation.RIGHT_TO_LEFT);
          JScrollPane scroll = new JScrollPane(txt);
          scroll.setComponentOrientation(ComponentOrientation.RIGHT_TO_LEFT);
          setPreferredSize(new Dimension(200,200));
          this.add(scroll);
      }
      private void display()
      {
          Object[] options = {this};
          JOptionPane pane = new JOptionPane();
          int option = pane.showOptionDialog(null, null, "Title", JOptionPane.DEFAULT_OPTION, JOptionPane.PLAIN_MESSAGE, null, options, options[0]);
      }
      public static void main(String[] args)
      {
          new TextArea().display();
      }
  }
  </code></pre>