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

TableColumnModel getColumnIndexAtX wrong value in RIGHT_TO_LEFT orientation

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Not an Issue
    • Icon: P4 P4
    • None
    • 1.4.1
    • client-libs



      Name: jk109818 Date: 01/16/2003


      FULL PRODUCT VERSION :
      java version "1.4.1_01"
      Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.1_01-b01)
      Java HotSpot(TM) Client VM (build 1.4.1_01-b01, mixed mode)


      FULL OPERATING SYSTEM VERSION :

      Microsoft Windows 2000 [Version 5.00.2195]

      A DESCRIPTION OF THE PROBLEM :
      In right to left order, all calls to
      TableColumnModel.getColumnIndexAtX return the row nr of the
      row the inverse X position.


      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      1. run attached test
      2. move table size to split table 2/3 to 1/3 in size
      3. Click on table header an watch console output

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      Clicking on 1st half of left column returns 0, should be 1
      2nd half of left column returns 1, ok
      right column returns 1, should be 0


      REPRODUCIBILITY :
      This bug can be reproduced always.

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

      $Header: /home/sun/src/JDK1.2/jTable.java,v 1.10 1999/11/30 13:26:44 isam Exp $

      Original Bug parade source from similar problem slighty modified with added
      mouse listener
      */

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

      public class jTable extends JApplet
      {
              public void init()
              {
                      SimpleTable st = new SimpleTable();
                      getContentPane().add(st);
              }


              public static void main(String[] argv)
              {
                      JFrame frame = new JFrame("\u0645\u062b\u0627\u0644");
                      frame.setContentPane(new SimpleTable());
                      frame.applyComponentOrientation(ComponentOrientation.RIGHT_TO_LEFT);

                      frame.pack();
                      frame.setVisible(true);
              }
      }


      class SimpleTable extends JPanel
      {

              public SimpleTable()
              {

                      final JTable jt = new JTable(new String[][]
                      {
                      {"\u05d6\u05d5\u0020\u05e9\u05e0\u05d4\u0020\u05d9\u05e4\u05d4",


      "\u0647\u0630\u0627\u0020\u064a\u0648\u0645\u0020\u0644\u0637\u064a\u0641\u0020\u05d6\u05d4\u0020\u05d9\u05d5\u05dd\u0020\u05e0\u05e2\u05d9\u05dd",


      "\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",


      "\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",
      "\u006c\u0069\u006d\u0065\u0020\u05d7\u05d5\u05de\u05d5\u05e1\u0020\u05d9\u05e7\u05e8\u0069\u0073\u0020\u0067\u0072\u0065\u0065\u006e"},


      {"\u05d6\u05d5\u0020\u05e9\u05e0\u05d4\u0020\u05d9\u05e4\u05d4\u0020\u0054\u0048\u0045\u0020\u0059\u0045\u0041\u0052\u0020\u0031\u0039\u0035\u0038",


      "\u05d7\u05d5\u05de\u05d5\u05e1\u0020\u006c\u0069\u006d\u0065\u0020\u0069\u0073\u0020\u0067\u0072\u0065\u0065\u006e\u0020\u05d9\u05e7\u05e8"
      ,"\u05d6\u05d5\u0020\u05e9\u05e0\u05d4\u0020\u05d9\u05e4\u05d4\u0020\u0054\u0048\u0045\u0020\u0059\u0045\u0041\u0052\u0020\u0031\u0039\u0035\u0038"}},

                     new String[]
      {"\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"});
          JScrollPane jsp = new JScrollPane(jt);
          //jt.setFont(new Font("Lucida Sans Regular",Font.PLAIN,15));
          jt.getTableHeader().addMouseListener(new MouseAdapter() {
            public void mouseClicked(MouseEvent me) {
               System.out.println("select Column: " +
      jt.getColumnModel().getColumnIndexAtX(me.getX()));
            }
          });

          add(jsp, BorderLayout.CENTER);
          add(new JLabel("Text"),BorderLayout.LINE_END);
              }
      }


      ---------- END SOURCE ----------
      (Review ID: 166675)
      ======================================================================

            shickeysunw Shannon Hickey (Inactive)
            jkimsunw Jeffrey Kim (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: