1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
|
public void updatePreferredScrollableViewportSize(int prefInitialRowCount)
{
/** definition de la taille préferée **/
int height = (this.getRowHeight() * prefInitialRowCount) +
(prefInitialRowCount > 1 ? (prefInitialRowCount - 1) * this.getRowMargin() : 0);
int width = 0;
for (int i = 0; i < this.getColumnModel().getColumnCount(); i++)
{ width += this.getColumnModel().getColumn(i).getPreferredWidth();
width += this.getColumnModel().getColumnMargin();
}
Dimension dim = new Dimension( width , height );
this.setPreferredScrollableViewportSize( dim );
} |
Partager