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

RTL orientation of a JTextPane does not insert spaces in the correct location

XMLWordPrintable

      FULL PRODUCT VERSION :
      java version "1.6.0_02"
      Java(TM) SE Runtime Environment (build 1.6.0_02-b06)
      Java HotSpot(TM) Client VM (build 1.6.0_02-b06, mixed mode, sharing)

      ADDITIONAL OS VERSION INFORMATION :
      Microsoft Windows XP [Version 5.1.2600

      A DESCRIPTION OF THE PROBLEM :
      Replication:
      - Edit the JTextComponentDemo for Right-To-Left orientation
      - Type some text (Arabic) until you have atleast 3 lines of text (do not hit Enter while typing)
      - Go to the second line, press "Home" and press "Space Bar"

      Notice the spaces are being inserted in the 1st line of text and not 2nd.

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      Replication:
      - Edit the JTextComponentDemo for Right-To-Left orientation
      - Type some text (Arabic) until you have atleast 3 lines of text (do not hit Enter while typing)
      - Go to the second line, press "Home" and press "Space Bar"

      Notice the spaces are being inserted in the 1st line of text and not 2nd.

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      The spaces should be inserted in the second line and text should be wrapped accordingly.
      ACTUAL -
      Spaces inserted in the first line

      REPRODUCIBILITY :
      This bug can be reproduced always.

      ---------- BEGIN SOURCE ----------
      Use the TextComponentDemo at http://java.sun.com/docs/books/tutorial/uiswing/examples/components/TextComponentDemoProject/src/components/TextComponentDemo.java and edit the constructor for RTL support as follows.

      textPane = new JTextPane();
              textPane.setComponentOrientation(ComponentOrientation.RIGHT_TO_LEFT);


      ---------- END SOURCE ----------

      CUSTOMER SUBMITTED WORKAROUND :
      No workaround found

            peterz Peter Zhelezniakov
            ryeung Roger Yeung (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Imported:
              Indexed: