Change the orientation of a JTextArea, eg. right to left

You can use the method setComponentOrientation defined in the Component class, so
you can invoke it on most Swing components.
It does not seem to work properly using JDK1.2, but does with JDK1.3.

import javax.swing.event.*;
import java.awt.event.*;
import javax.swing.*;
import java.util.*;
import java.awt.*;
public class Main extends JFrame
   public Main() throws Exception {
      JTextArea tf = new JTextArea();

      addWindowListener(new WindowAdapter() {
         public void windowClosing(WindowEvent e) {
   public static void main(String args[]) throws Exception {
      Main main = new Main();;

For international applications, you can determine the orientation using
the Locale:

      Locale arabic = new Locale("ar", "SA");