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

Smarter implementation of horizontal scrolling JTable

XMLWordPrintable

    • Icon: Enhancement Enhancement
    • Resolution: Duplicate
    • Icon: P4 P4
    • None
    • 1.2.0
    • client-libs



      Name: vi73552 Date: 06/14/99


      The following code comes from the source of javax.swing.JTable in JDK 1.2:

      -------------------------------------------------------------
      public int getScrollableUnitIncrement(Rectangle visibleRect, int orientation, int direction) {
        // PENDING(alan): do something smarter
        if (orientation == SwingConstants.HORIZONTAL) {
                return 100;
        }
        return rowHeight;
      }

      -------------------------------------------------------------



      The following implementation of this method scrolls one column at a time when scrolling horizontally:

      -------------------------------------------------------------
          int increment = rowHeight;

          if (orientation == SwingConstants.HORIZONTAL) {
            int column = columnAtPoint(visibleRect.getLocation());

            TableColumn tableColumn = null;
            if (direction < 0) {
              tableColumn = getColumnModel().getColumn(column - 1);
            }
            else {
              tableColumn = getColumnModel().getColumn(column);
            }

            if (tableColumn != null) {
              increment = tableColumn.getWidth() + 1; // add 1 to count for the line separating columns
            }
          }

          return increment;
        }
      -------------------------------------------------------------
      (Review ID: 84307)
      ======================================================================

            dmcduffisunw Dale Mcduffie (Inactive)
            vasya Vassili Igouchkine (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: