I realized a JTable with a custom AbstractTableModel
for implementing paging.
I wanna show 5 item per page, but I\'ve a problem: if I have N item to show (with N wh
Just pin the the value to its acceptable maximum:
realRow = Math.min(realRow, getRowCount());
Addendum: In the example cited, implement getValueAt()
as follows:
// Work only on the visible part of the table.
public Object getValueAt(int row, int col) {
int realRow = row + (pageOffset * pageSize);
if (realRow < data.length) {
return data[realRow].getValueAt(col);
} else {
return null;
}
}
Also consider BasicArrowButton.