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

JTextArea does not obey setWrapStyleWord(false) with right-to-left text.

XMLWordPrintable

    • Cause Known
    • x86
    • windows_2000

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

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

      ADDITIONAL OS VERSION INFORMATION :
      Microsoft Windows 2000 [Version 5.00.2195]

      A DESCRIPTION OF THE PROBLEM :
      When using a JTextArea with right-toleft text (arabic) the text area does not perform line wrapping on a character boundry and instead always uses the word boundries.

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      Run the demo program provided. When the frame opens notice that the text area is wrapping at word boundries instead of character boundries.



      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      The text area should wrap at character boundries.
      ACTUAL -
      The text area wraps on the word (spaces).

      ERROR MESSAGES/STACK TRACES THAT OCCUR :
      No error is reported.

      REPRODUCIBILITY :
      This bug can be reproduced always.

      ---------- BEGIN SOURCE ----------
      import java.awt.Font;

      import javax.swing.JFrame;
      import javax.swing.JScrollPane;
      import javax.swing.JTextArea;

      public class JTextAreaBidiCharWrapError
      extends JFrame
      {
          JTextArea textArea_ = new JTextArea();
          
          public JTextAreaBidiCharWrapError()
          {
              super("JTextArea Bidi Character Wrap Error");
              
              // Turn line wrap on but wrap on word off.
              // Insert some text including an Arabic Alef
              // to force the JTextArea into "I18N" mode.
              // Note that the display does wrap on
              // word boundries instead of character boundries.
              // (I use a monospaced font to make the display
              // easier to see the wrapping is on words and not
              // characters.)
              textArea_.setFont(
                      new Font("Monospaced", Font.PLAIN, 14));
              textArea_.setLineWrap(true);
              textArea_.setWrapStyleWord(false);
              textArea_.setText(
               "alef-\u0627- abcde fghij klmno pqrst uvwxy z\n" +
               "\n");
              
              getContentPane().add(new JScrollPane(textArea_));
              setDefaultCloseOperation(EXIT_ON_CLOSE);
              pack();
              setVisible(true);
          }
          
          public static void main(String[] args)
          {
              new JTextAreaBidiCharWrapError();
          }
      }

      ---------- END SOURCE ----------
      ###@###.### 2004-11-12 00:08:18 GMT

            peterz Peter Zhelezniakov
            rmandalasunw Ranjith Mandala (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Imported:
              Indexed: