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

In RTL, English and Hebrew text dispalyed differently in JLabel vs JTextField

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Duplicate
    • Icon: P4 P4
    • None
    • 7u51
    • client-libs

      FULL PRODUCT VERSION :
      C:\Java\jdk1.7.0_40\bin>java.exe -version
      java version "1.7.0_40"
      Java(TM) SE Runtime Environment (build 1.7.0_40-b43)
      Java HotSpot(TM) Client VM (build 24.0-b56, mixed mode, sharing)

      ADDITIONAL OS VERSION INFORMATION :
      Microsoft Windows [Version 6.1.7601]

      A DESCRIPTION OF THE PROBLEM :
      A mixture of Hebrew and English text displays differently in a JLabel and a JTextField when both controls are in RTL mode. When a string starts with an English word, a space, and then a Hebrew word, the label displays the text as LTR. If the Hebrew word is first, then the text is displayed as RTL.



      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      1. Create a simple Swing application with a JLabel and JTextField.
      2. Set the orientation on both to RIGHT_TO_LEFT.
      3. Create a String variable where you type "Apple", a space, and then 3 Hebrew letters (e.g. Apple ללל)
      4. Set that String to the label and text field.


      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      The label and text field display the string the same way - ללל Apple
      ACTUAL -
      The label displays the text as: Apple ללל
      The text field displays the text as: ללל Apple

      The label displays the text as LTR.

      REPRODUCIBILITY :
      This bug can be reproduced always.

      CUSTOMER SUBMITTED WORKAROUND :
      Add an RTL marker at the beginning of the string which will force the label to display the text as RTL.

            aivanov Alexey Ivanov
            webbuggrp Webbug Group
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: