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

Area inside ScrollPane and not used by JTable not drawing correctly

XMLWordPrintable

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



      Name: ssT124754 Date: 01/12/2001


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

      - Start the included example.
      - Increase framesize to the right so that there is an area inside
        the scrollpane that is not coverd by the table
      - drag scrollbar knob around (clicking above or below it does not show error)

      The area inside the scrollpane but not coverd by jtable is not
      painted correctly. It appears more often, if tablemodel.getValueAt
      is slow.

      code:
      package bugreport;

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

      public class Bug extends JFrame {

        JTable scrollTable;
        TableModel sourceModel;
        JScrollPane scrollPane;

        public Bug() {
          sourceModel = new MyTableModel();
          scrollTable = new JTable(sourceModel);
          scrollTable.setPreferredScrollableViewportSize(new Dimension (100,200));
          scrollTable.setAutoResizeMode(JTable.AUTO_RESIZE_OFF);

          scrollPane = new JScrollPane(scrollTable,
      JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED,
      JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
          getContentPane().setLayout(new BorderLayout());
          getContentPane().add(scrollPane, BorderLayout.CENTER);

        }
        public static void main(String[] args) {
          Bug bug = new Bug();
          bug.setSize(400,300);
          bug.show();
        }

        class MyTableModel extends AbstractTableModel {
          public int getRowCount() {
            return 100;
          }
          public int getColumnCount() {
            return 5;
          }
          public Object getValueAt(int rowIndex, int columnIndex) {
            try {
              Thread.currentThread().sleep(1);
            } catch (InterruptedException ie) {}
            return "A";
          }
        }
      }
      (Review ID: 114169)
      ======================================================================

            svioletsunw Scott Violet (Inactive)
            ssultanasunw Shaheen Sultana (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: