Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-4301637

JTextArea doesn't respond well to setComponentOrientation

XMLWordPrintable



      Name: skT88420 Date: 12/23/99


      "java version "1.3beta
      )Java(TM) 2 Runtime Environment, Standard Edition (build 1.3beta-O)
      Java(TM) HotSpot Client VM (build 1.3beta-O, mixed mode


      1.Take a JTextArea and call its setComponentOrientation() method with
      ComponentOrientation.RIGHT_TO_LEFT as parameter and you will be able to notice
      that the caret wont pass to the right side. (but it would work with JTextField)

      here I simply copied the code I have (so dont pay notice to irrelevant stuff)

                                               Thanks ,
                                                       Daniel

      //import com.sun.java.swing.*;
      import java.awt.event.*;
      import java.awt.*;
      import javax.swing.*;
      import java.util.*;
      /**
       *
       */
      public class Jspi extends javax.swing.JApplet {
      public void init() {
      getContentPane().setLayout(new GridLayout(5, 1, 10, 10));

      final JTextArea jt = new JTextArea();
      jt.setBackground(Color.cyan);

      jt.addKeyListener(new java.awt.event.KeyAdapter() {
      public void keyTyped(java.awt.event.KeyEvent ke) {
      System.out.println("JText: " +
      Integer.toHexString((int) ke.getKeyChar()));
      }
      });

      getContentPane().add(jt);

      final JTextField tf = new JTextField ();
      tf.setFont( new Font("unicode",0,14 ) );
      //tf.setText("\u00e0\u00c0\u00e8\u00c8\u00ec\u00cc\u00f2");

      tf.addActionListener(new ActionListener() {
      public void actionPerformed(ActionEvent ae) {
      int take = Integer.parseInt(tf.getText(), 16);
      jt.append((char) take + "");

      tf.setText("");
      }
      });
      tf.setComponentOrientation(ComponentOrientation.RIGHT_TO_LEFT) ;
      jt.setComponentOrientation(ComponentOrientation.RIGHT_TO_LEFT) ;
      getContentPane().add(tf) ;
      }
      }
      (Review ID: 99307)
      ======================================================================

            peytoia Yuka Kamiya (Inactive)
            skonchad Sandeep Konchady
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: