-
Bug
-
Resolution: Fixed
-
P3
-
2.0_beta2, 1.0.2
-
1.2.2
-
generic, sparc
-
solaris_2.6
When using the JScrollPane to view a big JTable, it is difficult to page
through the table because clicking in the vertical scrollbar advances
forward more than a page full (i.e. it skips data). In order to see all the
table data, you must either scroll forward a line at a time (very painful) or guess how far to move the scroll bar in order to see the next page completely.
here is the test program:
import java.awt.Frame;
import com.sun.java.swing.BoxLayout;
import com.sun.java.swing.JScrollPane;
import com.sun.java.swing.JPanel;
import com.sun.java.swing.JTable;
import com.sun.java.swing.table.AbstractTableModel;
public class Test {
public static void main(String[] args) {
Frame frm = new Frame("Test");
JScrollPane spane = new JScrollPane();
frm.add(spane);
JPanel panel = new JPanel();
panel.setLayout(new BoxLayout(panel, BoxLayout.Y_AXIS));
spane.getViewport().add(panel);
JTable tbl = new JTable(
new AbstractTableModel() {
public int getColumnCount() { return 10; }
public int getRowCount() { return 1000;}
public Object getValueAt(int row, int col) { return new
Integer(row*col)
; }
}
);
panel.add(tbl);
frm.pack();
frm.show();
}
}
through the table because clicking in the vertical scrollbar advances
forward more than a page full (i.e. it skips data). In order to see all the
table data, you must either scroll forward a line at a time (very painful) or guess how far to move the scroll bar in order to see the next page completely.
here is the test program:
import java.awt.Frame;
import com.sun.java.swing.BoxLayout;
import com.sun.java.swing.JScrollPane;
import com.sun.java.swing.JPanel;
import com.sun.java.swing.JTable;
import com.sun.java.swing.table.AbstractTableModel;
public class Test {
public static void main(String[] args) {
Frame frm = new Frame("Test");
JScrollPane spane = new JScrollPane();
frm.add(spane);
JPanel panel = new JPanel();
panel.setLayout(new BoxLayout(panel, BoxLayout.Y_AXIS));
spane.getViewport().add(panel);
JTable tbl = new JTable(
new AbstractTableModel() {
public int getColumnCount() { return 10; }
public int getRowCount() { return 1000;}
public Object getValueAt(int row, int col) { return new
Integer(row*col)
; }
}
);
panel.add(tbl);
frm.pack();
frm.show();
}
}