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

REGRESSION: JTextArea Cursor jumps strangely in Arabic

    XMLWordPrintable

    Details

      Description

      Name: jl125535 Date: 02/23/2004


      FULL PRODUCT VERSION :
      java version "1.5.0-beta"
      Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0-b
      Java HotSpot(TM) Client VM (build 1.5.0-beta-b32c, mixed mode)

      ADDITIONAL OS VERSION INFORMATION :
      Windows XP and Windows 2000

      EXTRA RELEVANT SYSTEM CONFIGURATION :
      Appears to be a general problem

      A DESCRIPTION OF THE PROBLEM :
      When typing Arabic text into a JTextArea, the cursor shold move from right to left inserting each Arabic letter to the left of its predecessor. When the space bar is pressed, the space should appear to the left of the last letter typed as if it were an ordinary character and then when the first letter of the following word is typed, the new word continues from right to left.
      This is how a JTextArea cursor used to behave in JDK 1.3
      For each word, as each Arabic letter is typed in, it appears to the left of the one previously typed. At the end of the word, when the space bar is pressed, the cursor moves to the beginning of the line and places the space there. When the next Arabic character is typed in, the space returns to the left hand end of the line and this character just typed appears in the correct position. The rest of the word is typed correctly until the next space is typed and the space and cursor again go to the far right of the line.
      Punctuation marks cause the same problem as spaces.
      This problem occurs with all the fonts that I have tried and is also exhibited when using the AWT TextArea.


      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      Set the Keyboard to Arabic and type Arabic script into a JTextArea, JTextPane or JEditorPane.


      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      When typing Arabic text into a JTextArea, the cursor shold move from right to left, inserting each Arbic letter to the left of its predecessor. When the space bar is pressed, the space should appear to the left of the last letter typed as if it were an ordinary character and then when the first letter of the following word is typed, the new word continues from right to left.
      This is how a JTextArea cursor did behave in JDK 1.3
      ACTUAL -
      For each word, as each Arabic letter is typed in, it appears to the left of the one previously typed. At the end of the word, when the space bar is pressed, the cursor moves to the beginning of the line and places the space there. When the next Arabic character is typed in, the space returns to the left hand end of the line and this character just typed appears in the correct position. The rest of the word is typed correctly until the next space is typed and the space and cursor again go to the far right of the line.
      Punctuation marks cause the same problem as spaces.

      REPRODUCIBILITY :
      This bug can be reproduced always.

      ---------- BEGIN SOURCE ----------
      package arabic_test;

      import java.awt.*;
      import java.awt.event.*;
      import javax.swing.*;

      public class Frame1 extends JFrame
      {
        private JPanel contentPane;
        private BorderLayout borderLayout1 = new BorderLayout();
        private JTextArea jTextArea1 = new JTextArea();

        //Construct the frame
        public Frame1()
        {
          enableEvents(AWTEvent.WINDOW_EVENT_MASK);
          try
          {
            jbInit();
          }
          catch(Exception e)
          {
            e.printStackTrace();
          }
        }
        //Component initialization
        private void jbInit() throws Exception
        {
          contentPane = (JPanel) this.getContentPane();
          contentPane.setLayout(borderLayout1);
          this.setSize(new Dimension(400, 300));
          this.setTitle("Frame Title");
          jTextArea1.setFont(new java.awt.Font("Times New Roman", 0, 20));
          contentPane.add(jTextArea1, BorderLayout.CENTER);
        }
        //Overridden so we can exit when window is closed
        protected void processWindowEvent(WindowEvent e)
        {
          super.processWindowEvent(e);
          if (e.getID() == WindowEvent.WINDOW_CLOSING)
          {
            System.exit(0);
          }
        }
      }
      ---------- END SOURCE ----------

      CUSTOMER SUBMITTED WORKAROUND :
      Use JDK 1.3

      Release Regression From : 1.3.1
      The above release value was the last known release where this
      bug was known to work. Since then there has been a regression.

      (Incident Review ID: 239744)
      ======================================================================

        Attachments

          Activity

            People

            Assignee:
            peterz Peter Zhelezniakov
            Reporter:
            jleesunw Jon Lee (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: