Since your TableCellRenderer
is just painting colored blocks, you could put the table in a FlowLayout
and override getPreferredScrollableViewportSize()
.
private static final int WIDE = 10;
private static final int HIGH = 20;
private static final int SIZE = 50;
...
@Override
public Dimension getPreferredScrollableViewportSize() {
return new Dimension(WIDE * SIZE, HIGH * SIZE);
}