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

JTable Header failed to renderer

    XMLWordPrintable

    Details

      Description

      FULL PRODUCT VERSION :


      A DESCRIPTION OF THE PROBLEM :
      JTable

      First setautoresize off
      then set the header height to 30

      When you scroll the horizontal bar, all of the header image cannot be
      painted.
      Because of the header cell renderer received a wrong column number.



      REPRODUCIBILITY :
      This bug can be reproduced always.
      ###@###.### 2005-06-09 09:03:38 GMT
      Test case (TableTest.java) added at the request of
      the jdk-collaboration.dev.java.net community:

      % cat TableTest.java
      import java.awt.Dimension;

      import javax.swing.JFrame;
      import javax.swing.JScrollPane;
      import javax.swing.JTable;
      import javax.swing.table.AbstractTableModel;


      public class TableTest {
          public static void main(String[] args) {
              JFrame frame = new JFrame();

              JTable table = new JTable(new String[][] { { "dddd", "eeee" } },
                                        new String[] { "fff", "sss" });

              table.setAutoResizeMode(JTable.AUTO_RESIZE_OFF);

              table.getColumnModel().getColumn(0).setPreferredWidth(600);

              int height = 30;
              Dimension dimension =
                  new Dimension(table.getTableHeader().getWidth(), height);
              table.getTableHeader().setPreferredSize(dimension);

              frame.getContentPane().add(new JScrollPane(table));

              frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
              frame.setLocation(100, 100);
              frame.setSize(400, 400);
              frame.setVisible(true);
          }
      }

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              shickeysunw Shannon Hickey (Inactive)
              Reporter:
              jssunw Jitender S (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:
                Imported:
                Indexed: