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

REGRESSION: JTable painting errors for largish table (regression)

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Duplicate
    • Icon: P4 P4
    • None
    • 1.4.0
    • client-libs
    • 2d
    • x86
    • linux



      Name: gm110360 Date: 11/16/2001


      java version "1.4.0-beta3"
      Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.0-beta3-b84)
      Java HotSpot(TM) Client VM (build 1.4.0-beta3-b84, mixed mode)


      When I create a JTable enclosed in a JScrollPane that contains more than about
      2200 rows, painting is corrupted when scrolling around rows past about 2000.

      Here's a modified version of SimpleTableDemo.java that displays the bug:

      import javax.swing.JTable;
      import javax.swing.JScrollPane;
      import javax.swing.JPanel;
      import javax.swing.JFrame;
      import java.awt.*;
      import java.awt.event.*;

      public class SimpleTableDemo extends JFrame {
          public SimpleTableDemo() {
              super("SimpleTableDemo");
              Object[][] data = {
                  {"Mary", "Campione",
                   "Snowboarding", new Integer(5), new Boolean(false)},
                  {"Alison", "Huml",
                   "Rowing", new Integer(3), new Boolean(true)},
                  {"Kathy", "Walrath",
                   "Chasing toddlers", new Integer(2), new Boolean(false)},
                  {"Mark", "Andrews",
                   "Speed reading", new Integer(20), new Boolean(true)},
                  {"Angela", "Lih",
                   "Teaching high school", new Integer(4), new Boolean(false)}
              };
              Object [][] data2 = new Object [2200][data[0].length];
              for (int i = 0; i < data2.length; i++) {
                data2[i] = (Object [])data[i%data.length].clone();
                data2[i][3] = new Integer(i+1);
              }
              String[] columnNames = {"First Name",
                                      "Last Name",
                                      "Sport",
                                      "# of Years",
                                      "Vegetarian"};
              final JTable table = new JTable(data2, columnNames);
              table.setPreferredScrollableViewportSize(new Dimension(500, 400));
              JScrollPane scrollPane = new JScrollPane(table);
              getContentPane().add(scrollPane, BorderLayout.CENTER);
              addWindowListener(new WindowAdapter() {
                  public void windowClosing(WindowEvent e) {
                      System.exit(0);
                  }
              });
          }

          public static void main(String[] args) {
              SimpleTableDemo frame = new SimpleTableDemo();
              frame.pack();
              frame.setVisible(true);
          }
      }


      Run this program -- painting corruption appears from row 2145 downwards.

      Running under jdk1.3 produces no painting problems, so this is a regression.

      Release Regression From : merlin-beta2
      The above release value was the last known release where this
      bug was knwon to work. Since then there has been a regression.

      (Review ID: 135774)
      ======================================================================

            tdv Dmitri Trembovetski (Inactive)
            gmanwanisunw Girish Manwani (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: