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

jdk1.5.0-b44, JComboBox is not displayed correctly with RTL ComponentOrienation

    XMLWordPrintable

Details

    • Bug
    • Resolution: Duplicate
    • P2
    • None
    • 5.0
    • client-libs

    Description

      Locale: All locales
      Regression: NO
      Build: b44
      Platforms: Windows, Linux, Solaris

      Setting the ComponentOrientation to RIGHT_TO_LEFT for JComboPanel causes the JComboPanel not to dispaly correctly. There are two problems with the dispaly of JComboPanel:

      1. The button is displayed at the right end instead of the left end
      2. The Scrollbar to the left of the popup list which appears underneath the text edit field is displayed off the limits of the JComboPanel.

      To reproduce this bug:
      1. Compile the following test case "jComboPanel_RTL.java"
      2. Run the test case under any OS available
      3. Note that the button with the down arrow is displayed to the right of text field
      4. Click the button
      5. Note that the scrollbar of the displayed pop list is displayed off the limits of the JComboPanel

      -------------------------------------------------
      /* Copyright (c) Sun Microsystems 1998

      $Header: /home-bazelet/sun/src/javaLab/JDK1.4/standard/jComboPanel_RTL.java,v 1.1.1.1 2001/06/19 15:01:31 isam Exp $

      */
      import java.awt.*;
      import java.awt.event.*;
      import java.util.*;
      import javax.swing.*;

      public class jComboPanel_RTL extends JApplet
      {
              public void init()
              {
               rtlComboBox combbox = new rtlComboBox();
               //getContentPane().add(rtlComboBox);
               getContentPane().setSize(10,10);
              }


              public static void main(String[] argv)
              {
               JFrame frame = new JFrame("RTL JComboBox");
               frame.setContentPane(new rtlComboBox());
               frame.setSize(650,400);

              frame.addWindowListener( new WindowAdapter()
              {
                   public void windowClosing( WindowEvent e)
                   {
                       System.exit(0);
                   }
              });
              frame.setVisible(true);
              }
      }

      class rtlComboBox extends JPanel
      {
              String title[] =
              {
                      "\u062a\u0641\u0627\u062d\u0020\u0623\u062d\u0645\u0631\u0020\u0643\u0628\u064a\u0631\u0020\u0042\u0049\u0047\u0020\u0052\u0045\u0044\u0020\u0041\u0050\u0050\u004c\u0045\u0053",
                      "\u0647\u0630\u0627\u0020\u064a\u0648\u0645\u0020\u0644\u0637\u064a\u0641\u0020\u05d6\u05d4\u0020\u05d9\u05d5\u05dd\u0020\u05e0\u05e2\u05d9\u05dd",
                      "\u05d6\u05d5\u0020\u05e9\u05e0\u05d4\u0020\u05d9\u05e4\u05d4\u0020\u0054\u0048\u0045\u0020\u0059\u0045\u0041\u0052\u0020\u0031\u0039\u0035\u0038",
                      "\u05d6\u05d5\u0020\u05e9\u05e0\u05d4\u0020",
                      "\u05ea\u05e4\u05d5\u05d6\u05d9\u05dd\u0020\u05d8\u05e2\u05de\u05d9\u05dd\u0020\u006c\u0069\u006d\u0065\u0020\u0069\u0073\u0020\u0067\u0072\u0065\u0065\u006e",
                      "\u006c\u0069\u006d\u0065\u0020\u0069\u0073\u0020\u0067\u0072\u0065\u0065\u006e\u05d7\u05d5\u05de\u05d5\u05e1\u0020\u05d9\u05e7\u05e8",
                      "\u006c\u0069\u006d\u0065\u0020\u05d7\u05d5\u05de\u05d5\u05e1\u0020\u05d9\u05e7\u05e8\u0069\u0073\u0020\u0067\u0072\u0065\u0065\u006e",
                      "\u05d7\u05d5\u05de\u05d5\u05e1\u0020\u006c\u0069\u006d\u0065\u0020\u0069\u0073\u0020\u0067\u0072\u0065\u0065\u006e\u0020\u05d9\u05e7\u05e8",
                      "\u062a\u0641\u0627\u062d\u0020\u0623\u062d\u0645\u0631\u0020\u0643\u0628\u064a\u0631",
                      "\u0648\u0644\u062f\u0020\u0635\u063a\u064a\u0631\u0020\u006c\u0069\u006d\u0065\u0020\u0069\u0073\u0020\u0067\u0072\u0065\u0065\u006e\u0020\u0648\u062c\u0645\u064a\u0644"
              };


              public rtlComboBox()
              {
                      JPanel p = new JPanel();
                      p.setPreferredSize(new Dimension(380,40));
                      JComboBox bookCombo = new JComboBox(title);
                      bookCombo.applyComponentOrientation(ComponentOrientation.RIGHT_TO_LEFT);
                      p.setComponentOrientation(ComponentOrientation.RIGHT_TO_LEFT);
                      bookCombo.setPreferredSize(new Dimension(240,25));
                      p.add(bookCombo);
                      add(p, BorderLayout.CENTER);
              }
      }
      -------------------------------------------------

      Attachments

        Issue Links

          Activity

            People

              peytoia Yuka Kamiya (Inactive)
              jbenavrasunw Jonathan Benavraham (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:
                Imported:
                Indexed: