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

Text alignment in JComboBoxes with CompOrient..RIGHT_TO_LEFT and Arabic text

    XMLWordPrintable

    Details

      Description

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

      ADDITIONAL OS VERSION INFORMATION :
      Win XP Version 5.1.2600

      A DESCRIPTION OF THE PROBLEM :
      Wrong text alignment JComboBoxes with ComponentOrientation.RIGHT_TO_LEFT and Arabic text in the popup list of the ComboBox. If Strings do not fit into the width of the list they are cut at the beginning (right side), short Strings are not seen at all.




      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      Use an application with Component Orientation Right to Leftt and Arabic text (which is written from right to left).
      Open a Combobox popup with long Strings in the list
      Try to read the text of the list items, it will be cut at the beginning. Short text items wount be seen at all

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      Arabic text should be seen right aligned and if to long to fit it should be cut at the end (left side)
      ACTUAL -
      Text is cut at the right side

      REPRODUCIBILITY :
      This bug can be reproduced always.

      ---------- BEGIN SOURCE ----------
      public class Frame1 extends JFrame {
          JPanel contentPane;
          JComboBox jComboBox1;
          FlowLayout flowLayout1 = new FlowLayout();
       
          public Frame1() {
              String[] items = {"\u062a\u062d\u0631\u064a\u0631 \u0627\u0644\u0627\u0634\u062e\u0627\u0635 \u062a\u062d\u0631\u064a\u0631", "\u0645\u0624\u0643\u0651\u062f", "\u062a\u062d\u0631\u064a\u0631 \u0627\u0644\u0648\u062d\u062f\u0627\u062a"};
              jComboBox1 = new JComboBox(items);
              contentPane = (JPanel) getContentPane();
              contentPane.setLayout(flowLayout1);
              setSize(new Dimension(400, 300));
              jComboBox1.setPreferredSize(new Dimension(80, 24));
              contentPane.add(jComboBox1, null);
              //needed to get popup oriented right to left
              ((JComponent)jComboBox1.getRenderer()).applyComponentOrientation(ComponentOrientation.RIGHT_TO_LEFT);
              this.applyComponentOrientation(ComponentOrientation.RIGHT_TO_LEFT);
              this.setVisible(true);
          }
       
          public static void main(String[] args) {
              new Frame1();
          }
      }
      ---------- END SOURCE ----------
      ###@###.### 2005-06-23 00:40:46 GMT

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              Unassigned Unassigned
              Reporter:
              gmanwanisunw Girish Manwani (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

                Dates

                Created:
                Updated:
                Imported:
                Indexed: