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

JTextArea w/out line wrap computes wrong line width w/ right-to-left text w/ tab

    Details

    • Subcomponent:
    • Understanding:
      Cause Known
    • CPU:
      x86
    • OS:
      windows_2000

      Description

      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 :

      The JTextArea does not compute the correct line width for a component containing both right-to-left text (arabic) and tabs. The line width seems to ignore the fact that the tabs exist and only displays the region of text equal to the width of the text without the tabs. This results in some of the text contained within the text area not being displayed to the user (i.e., you can not scroll to the portion of the text past the width of the non-tabbed text).





      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      Run the demo provided. Notice that the entire (English) alphabet is not displayed. On my systems it stops around the letter 'n'. You can not scroll to the text but you can select and copy/cut the text using the keyboard.



      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      The full contents of the text area should be displayable via the scroll bar.
      ACTUAL -
      You can not scroll to see the letter 'z'.

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

      REPRODUCIBILITY :
      This bug can be reproduced always.

      ---------- BEGIN SOURCE ----------
      import javax.swing.JFrame;
      import javax.swing.JScrollPane;
      import javax.swing.JTextArea;

      public class JTextAreaBidiTabError
      extends JFrame
      {
          JTextArea textArea_ = new JTextArea();
          
          public JTextAreaBidiTabError()
          {
              super("JTextArea Bidi Tab Error");
              
              // Turn line wrap off and insert some text
              // including an Arabic Alef to force the
              // JTextArea into "I18N" mode. Include
              // a tab to show the view is incorrectly
              // computing the line width with the tab.
              textArea_.setLineWrap(false);
              textArea_.setText(
               "\talef-\u0627-abcdefghijklmnopqrstuvwxyz\n" +
               // Uncomment this line to see that the line
               // width calculated is actually the untabbed
               // width.
               //"alef-\u0627-abcdefghijklmnopqrstuvwxyz\n" +
               "\n");
              
              getContentPane().add(new JScrollPane(textArea_));
              setDefaultCloseOperation(EXIT_ON_CLOSE);
              pack();
              setVisible(true);
          }
          
          public static void main(String[] args)
          {
              new JTextAreaBidiTabError();
          }
      }

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

        Attachments

          Activity

            People

            • Assignee:
              peterz Peter Zhelezniakov (Inactive)
              Reporter:
              rmandalasunw Ranjith Mandala (Inactive)
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Imported:
                Indexed: