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

JCheckBox fails to inherit alignment from locale and is always aligned Left

XMLWordPrintable

    • beta2
    • x86
    • generic
    • Verified



      Name: jbT81659 Date: 02/28/2001

      OS: all Os's
      JDK: 1.4.0-Beta-b52

      JCheckBox fails to set ites alignment to Right if locale is RTL. JCheckBox
      inherits its Component Orientation from the locale and sets it to RTL if locale is right, but
      fails to apply that to its alignment.
      To reproduce bug:
      You need to test this test case under two platforms.
      The first platform is setup with an RTL locale,
      while the second platform is setup with an LTR locale.
      Since this problem is platform independent you can
      choose Win98 (Arabic/enabled or localized) as your first platform
      and Redhat linux(6.2) as your second platform.
      1- Compile and run the test case under Win98(Arabic enabled)
      2- Compile and run the test case under Redhat Linux
      3- Note that for step1, all jCheckBoxes are aligned to the left
      4- Note that for step2, all jCheckBoxes are aligned to the left
      5- Note that for step1, all jCheckBoxes ComponentOrientation is inherited from locale and is RTL
      6- Note that for step2, all jCheckBoxes ComponentOrientation is inherited from locale and is LTR

      /* Copyright (c) Sun Microsystems 1998

      $Header: /home/sun/src/JDK1.2/jCheckBox.java,v 1.15 2000/03/30 08:13:08 isam Exp $

      */

      import java.awt.*;
      import java.awt.event.*;
      import java.net.*;
      import java.applet.*;
      import javax.swing.*;
      import java.util.*;

      public class jCheckBox extends JApplet
      {

              public void init()
              {
                 jCheckBox1 chckbox1 = new jCheckBox1();
                 getContentPane().add(chckbox1);
          }
              public static void main(String[] argv)
              {

              JFrame frame = new JFrame("\u0645\u062b\u0627\u0644");
              frame.setContentPane(new jCheckBox1());
              frame.pack();
              frame.setVisible(true);
              frame.addWindowListener( new WindowAdapter()
              {
                 public void windowClosing( WindowEvent e)
                 {
                      System.exit(0);
                 }
              });
          }
      }

      class jCheckBox1 extends JPanel
      {
              public jCheckBox1()
              {
                      JCheckBox Box1, Box2, Box3, Box4, Box5, Box6, Box7, Box8, Box9, Box10;
              this.setLayout(new GridLayout(11,1));

              Box1 = new JCheckBox("\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");

              Box2 = new JCheckBox("\u05d6\u05d5\u0020\u05e9\u05e0\u05d4\u0020\u05d9\u05e4\u05d4\u0020\u0054\u0048\u0045\u0020\u0059\u0045\u0041\u0052\u0020\u0031\u0039\u0035\u0038");

              Box3 = new JCheckBox("\u0647\u0630\u0627\u0020\u064a\u0648\u0645\u0020\u0644\u0637\u064a\u0641\u0020\u05d6\u05d4\u0020\u05d9\u05d5\u05dd\u0020\u05e0\u05e2\u05d9\u05dd");

              Box4 = new JCheckBox("\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");
              Box5 = new JCheckBox("\u0647\u0630\u0627\u0020\u064a\u0648\u0645\u0020\u0644\u0637\u064a\u0641\u0020\u05d6\u05d4\u0020\u05d9\u05d5\u05dd\u0020\u05e0\u05e2\u05d9\u05dd");
              Box6 = new JCheckBox("\u05d6\u05d5\u0020\u05e9\u05e0\u05d4\u0020\u05d9\u05e4\u05d4\u0020\u0054\u0048\u0045\u0020\u0059\u0045\u0041\u0052\u0020\u0031\u0039\u0035\u0038");
              Box7 = new JCheckBox("\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");
              Box7.setFont(new Font("Lucida Sans Regular", Font.PLAIN, 18));
              Box8 = new JCheckBox("\u006c\u0069\u006d\u0065\u0020\u0069\u0073\u0020\u0067\u0072\u0065\u0065\u006e\u05d7\u05d5\u05de\u05d5\u05e1\u0020\u05d9\u05e7\u05e8");
              Box9 = new JCheckBox("\u006c\u0069\u006d\u0065\u0020\u05d7\u05d5\u05de\u05d5\u05e1\u0020\u05d9\u05e7\u05e8\u0069\u0073\u0020\u0067\u0072\u0065\u0065\u006e");
              Box10 = new JCheckBox("\u05d7\u05d5\u05de\u05d5\u05e1\u0020\u006c\u0069\u006d\u0065\u0020\u0069\u0073\u0020\u0067\u0072\u0065\u0065\u006e\u0020\u05d9\u05e7\u05e8");

              Box1.setFont(new Font("Lucida Sans Regular", Font.PLAIN, 18));
              Box2.setFont(new Font("Lucida Sans Regular", Font.PLAIN, 18));
              Box3.setFont(new Font("Lucida Sans Regular", Font.PLAIN, 18));
              Box4.setFont(new Font("Lucida Sans Regular", Font.PLAIN, 18));
              Box5.setFont(new Font("Lucida Sans Regular", Font.PLAIN, 18));
              Box6.setFont(new Font("Lucida Sans Regular", Font.PLAIN, 18));
              Box8.setFont(new Font("Lucida Sans Regular", Font.PLAIN, 18));
              Box9.setFont(new Font("Lucida Sans Regular", Font.PLAIN, 18));
              Box10.setFont(new Font("Lucida Sans Regular", Font.PLAIN, 18));

                      add(Box1);
                      add(Box2);
              add(Box3);
              add(Box4);
              add(Box5);
              add(Box6);
              add(Box7);
              add(Box8);
              add(Box9);
              add(Box10);
              }
      }



      ======================================================================

            bcbeck Brian Beck (Inactive)
            jbenavrasunw Jonathan Benavraham (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: