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

BiDi problem in JComboBox & JTable

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Duplicate
    • Icon: P4 P4
    • None
    • 1.3.0
    • client-libs



      Name: skT88420 Date: 02/07/2000


      java version "1.3.0rc1"
      Java(TM) 2 Runtime Environment, Standard Edition (build 1.3.0rc1-T)
      Java HotSpot(TM) Client VM (build 1.3.0rc1-S, mixed mode)

      I am writing an application using Swing.
      The application is in Hebrew (written from right to left).
      I am using the method:
      "setComponentOrientation(ComponentOrientation.RIGHT_TO_LEFT)"
      in order to get a right alignment of the component.
      In some components it works (JTree,JTextField,JList) but
      in other it is not (JTable,JComboBox).
      Here is a piece of code demonstrating the JTable problem:
      (The weird chars are hebrew chars)

      import javax.swing.*;
      import javax.swing.table.*;

      import java.awt.*;
      import java.util.*;
      import java.awt.event.*;


      public class HebTable extends JApplet {
        JTable t = null;
        JButton b = null;
        String []ColumnNames = {"??","????","?????","?????"};
        Object rowData[][] = {
           {"????","12","12-11-1997",new Boolean(true)},
      {"???","13","12-11-1997",new Boolean(true)},
      {"????","14","12-11-1997",new Boolean(false)},
      {"????","15","12-11-1997",new Boolean(true)}
        };
        public void init() {
          Container c = this.getContentPane();
        t = new JTable(rowData,ColumnNames);
      b = new JButton("Change RTL mode");
      b.addActionListener(new ButtonListener());
          b.setComponentOrientation(ComponentOrientation.RIGHT_TO_LEFT);
      t.setComponentOrientation(ComponentOrientation.RIGHT_TO_LEFT);
      c.add(t.getTableHeader(),BorderLayout.NORTH);
      c.add(t);
      c.add(b,BorderLayout.SOUTH);
        }
        private void switchOrientation() {
           if(t.getComponentOrientation() == ComponentOrientation.RIGHT_TO_LEFT)
      t.setComponentOrientation(ComponentOrientation.LEFT_TO_RIGHT);
           else
      t.setComponentOrientation(ComponentOrientation.RIGHT_TO_LEFT);
           System.out.println((t.getComponentOrientation() ==
      ComponentOrientation.RIGHT_TO_LEFT) ? "RIGHT_TO_LEFT" : "NOT RIGHT_TO_LEFT") ;
        }

        class ButtonListener implements ActionListener {
            public void actionPerformed(ActionEvent e) {
      switchOrientation();
      }
        
        }
      }
      (Review ID: 100889)
      ======================================================================

            bcbeck Brian Beck (Inactive)
            skonchad Sandeep Konchady
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: