-
Enhancement
-
Resolution: Duplicate
-
P4
-
None
-
1.2.0
-
generic
-
generic
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)
======================================================================
- duplicates
-
JDK-4208273 JTable.getScrollableUnitIncrement(...) returns incorrect value
-
- Closed
-