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

Vertical scrollbar should occupy empty top leading corner space

    Details

      Description

      FULL PRODUCT VERSION :
      java version "1.6.0"
      Java (TM) SE Runtime Environment (build 1.6.0-b105)
      Java HotSpot(TM) Client VM (build 1.6.0-b105, mixed-mode)

      ADDITIONAL OS VERSION INFORMATION :
      Microsoft Windows XP [Version 5.1.2600]

      A DESCRIPTION OF THE PROBLEM :
      When there is no top-leading corner component in a JScrollPane which contains a column header (such as when the content is a JTable), it would look better if the vertical scrollbar filled the dead space. For example, look at a Windows file exporer in details view. The scroll bar extends right to the top. This is arguably a better behaviour for all platforms.

      I intend to contribute a simple patch via OpenJDK.

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      Run the attatched test case. Observe the dead space in the top right corner. It just looks odd. It is particularly noticable in JFileChoosers in details view.

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      Vertical scrollbar should start right at the top of the table.
      ACTUAL -
      Vertical scrollbar starts at the bottom of the column header, leaving dead space in the corner.

      REPRODUCIBILITY :
      This bug can be reproduced always.

      ---------- BEGIN SOURCE ----------
      import javax.swing.*;
      import javax.swing.table.AbstractTableModel;


      public class Main {

          public static void main(String[] args) {
              SwingUtilities.invokeLater(new Runnable() {
                  public void run() {
                      JTable t = new JTable(new TableModel());
                      t.setAutoResizeMode(JTable.AUTO_RESIZE_OFF);
                      JScrollPane scroll = new JScrollPane(t);
                      JFrame f = new JFrame();
                      f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
                      f.add(scroll);
                      f.setSize(200, 200);
                      f.setLocationRelativeTo(null);
                      f.setVisible(true);
                  }
              });
          }
          
          private static class TableModel extends AbstractTableModel {

              public int getRowCount() {
                  return 20;
              }

              public int getColumnCount() {
                  return 5;
              }

              public Object getValueAt(int rowIndex, int columnIndex) {
                  return " ";
              }
          }
      }

      ---------- END SOURCE ----------

        Attachments

          Activity

            People

            • Assignee:
              peterz Peter Zhelezniakov
              Reporter:
              ndcosta Nelson Dcosta (Inactive)
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Imported:
                Indexed: