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

VScroll w/mouse dragging does not scroll all the way to the bottom of the table

XMLWordPrintable

    • generic, x86
    • generic, windows_xp

      Name: rmT116609 Date: 05/20/2004


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

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

      ADDITIONAL OS VERSION INFORMATION :
      Windows XP and Windows 2000.

      A DESCRIPTION OF THE PROBLEM :
      Autoscroll does not scroll all the way down on a table with a ScrollPane. The scroll suddenly stops, some rows are not either visible or selected.

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      Execute the test case.
      Select the first row, hold the mouse left-button and drag the cursor below the dialog.

      Vertical autoscroll starts happening and you can see that the table starts scrolling.

      Before the scroll reaches the last row, the scroll stops.

      As you can see the vertical scroll button is not at the bottom of the table.

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      Vertical scroll should move all the way down.
      ACTUAL -
      Some rows are not selected and vertical scroll is not at the bottom.

      REPRODUCIBILITY :
      This bug can be reproduced always.

      ---------- BEGIN SOURCE ----------
      import java.awt.BorderLayout;
      import java.awt.Dimension;
      import java.awt.event.WindowAdapter;
      import java.awt.event.WindowEvent;

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

      public class TableDemo extends JFrame {
          private boolean DEBUG = true;

          public TableDemo() {
              super("TableDemo");

              MyTableModel myModel = new MyTableModel();
              JTable table = new JTable(myModel);
              table.setPreferredScrollableViewportSize(new Dimension(500, 200));
      table.setAutoResizeMode(JTable.AUTO_RESIZE_OFF);

              //Create the scroll pane and add the table to it.
              JScrollPane scrollPane = new JScrollPane(table);

              //Add the scroll pane to this window.
              getContentPane().add(scrollPane, BorderLayout.CENTER);

              addWindowListener(new WindowAdapter() {
                  public void windowClosing(WindowEvent e) {
                      System.exit(0);
                  }
              });
          }

          class MyTableModel extends AbstractTableModel {
              final String[] columnNames = {"Column1",
                                            "Column2",
                                            "Column2" };

              public int getColumnCount() {
                  return 3;
              }
              
              public int getRowCount() {
                  return 100;
              }

              public String getColumnName(int col) {
                  return columnNames[col];
              }

              public Object getValueAt(int row, int col) {
                  return "Row" + row + "Col " + col;
                        
              }

              /*
               * Don't need to implement this method unless your table's
               * editable.
               */
              public boolean isCellEditable(int row, int col) {
                  return false;
              }


          }

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

      ---------- END SOURCE ----------
      (Incident Review ID: 270463)
      ======================================================================

            shickeysunw Shannon Hickey (Inactive)
            rmandalasunw Ranjith Mandala (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: