posted 23 years ago
Hi, I'm trying to build a JTable that has scrollbars when the data of the table does not fit in the visible part.
Here's what I do:
JTable table = new JTable(....);
JScrollPane scrollPane = new JScrollPane(table);
This does not provide any scrollbars. On the tutorial page of Sun/ Swing I read several tips, like:
contentPane.setPreferredSize(new Dimension(x,y));
This didn't work (my compiler complains that Container class does not know the setPreferredSize(...) method)
I tried other stuff: like:
table.setPreferredScrollableViewportSize(new Dimension(x,y));
no luck either.
Obviously, I'm totally missing the point on how to use the JScrollPane stuff.
In summary:
the JTable is about 800 pixels wide, and about 300 pixels high (depending on amount of rows visible).
The visible part of the table (the JScrollPane) is 550 pixels wide and 300 pixels high.
How to get scrollbars on the table?
Any pointers are more than welcome!
Thanks in advance,
Eelco
== <br />Rgrds,<br />Eelco<br /> <br />SCJP, SCJD, SCBCD, SCWD, SCEA