List of utility methods to do JTable Row Visible
void | makeRowVisible(JTable table, int row) Make the given row in the table visible Rectangle cellRect = table.getCellRect(row, 0, true);
if (cellRect != null) {
table.scrollRectToVisible(cellRect);
|
void | setupTableUI(JTable table, int visibleRows) setup Table UI table.setPreferredScrollableViewportSize(new Dimension(table.getPreferredScrollableViewportSize().width,
table.getRowHeight() * visibleRows));
Font font = table.getFont();
table.setRowHeight(table.getFontMetrics(font).getHeight() + 5);
|
void | setVisibleRowCount(final JTable table, final int rows) Set the preferred viewport size on a table based upon the number of rows that should be visible and the current heights of the rows. int height = 0; for (int row = 0; row < rows; row++) { height += table.getRowHeight(row); table.setPreferredScrollableViewportSize( new Dimension(table.getPreferredScrollableViewportSize().width, height)); |
void | setVisibleRowCount(final JTable table, final int rows) Sizes the table to number of rows using getRowHeight if (table != null) { table.setPreferredScrollableViewportSize( new Dimension(table.getPreferredScrollableViewportSize().width, rows * table.getRowHeight())); |