A
Allan Valeriano
Hi,
I'm inserting a JTable into a JScrollPane which is inserted inside a
JPanel. I'd like to set the size of this JScrollPane to be the same as
the JPanel, so it will show a blank space between the end of my JTable
and the end of my JScrollPane.
I've tryed something like:
table.setPreferredScrollableViewportSize(panel.getSize());
but is not working as I wanted. On this picture, there is a grey space
between the end of the table and the end of the window:
http://java.sun.com/docs/books/tutorial/figures/uiswing/components/TableRenderDemo.png
This is because the JScrollPane resizes itself, to fit the size of the
table, but I want it not to resize like that if the table is smaller
then the Panel, so there will be a blank space between the last table
row and the end of the JScrollPane and not between the end of the
JScrollPane and the end of the window.
Does anybody knows how can I do that?
I'm inserting a JTable into a JScrollPane which is inserted inside a
JPanel. I'd like to set the size of this JScrollPane to be the same as
the JPanel, so it will show a blank space between the end of my JTable
and the end of my JScrollPane.
I've tryed something like:
table.setPreferredScrollableViewportSize(panel.getSize());
but is not working as I wanted. On this picture, there is a grey space
between the end of the table and the end of the window:
http://java.sun.com/docs/books/tutorial/figures/uiswing/components/TableRenderDemo.png
This is because the JScrollPane resizes itself, to fit the size of the
table, but I want it not to resize like that if the table is smaller
then the Panel, so there will be a blank space between the last table
row and the end of the JScrollPane and not between the end of the
JScrollPane and the end of the window.
Does anybody knows how can I do that?