994 |
*/ |
*/ |
995 |
public Dimension getPreferredScrollableViewportSize() |
public Dimension getPreferredScrollableViewportSize() |
996 |
{ |
{ |
997 |
return getPreferredSize(); |
int vis = getVisibleRowCount(); |
998 |
|
int nrows = getModel() == null ? 0 : getModel().getSize(); |
999 |
|
// FIXME: this is a somewhat arbitrary default, but.. ? |
1000 |
|
Dimension single = new Dimension(10, 10);; |
1001 |
|
Rectangle bounds = null; |
1002 |
|
|
1003 |
|
if (vis > nrows) |
1004 |
|
{ |
1005 |
|
if (fixedCellWidth != -1 && |
1006 |
|
fixedCellHeight != -1) |
1007 |
|
{ |
1008 |
|
single = new Dimension(fixedCellWidth, fixedCellHeight); |
1009 |
|
} |
1010 |
|
else if (nrows != 0 && getUI() != null) |
1011 |
|
{ |
1012 |
|
Rectangle tmp = getUI().getCellBounds(this, 0, 0); |
1013 |
|
if (tmp != null) |
1014 |
|
single = tmp.getSize(); |
1015 |
|
} |
1016 |
|
} |
1017 |
|
else if (getUI() != null) |
1018 |
|
{ |
1019 |
|
return getUI().getCellBounds(this, 0, vis - 1).getSize(); |
1020 |
|
} |
1021 |
|
|
1022 |
|
return new Dimension(single.width, single.height * vis); |
1023 |
} |
} |
1024 |
|
|
1025 |
/** |
/** |