I have a JTable in a JScrollPane but I do not want the first two
colums to scroll when I move the scroll bar. I want the first two
columns to stay on the screen and the rest of the columns in my JTable
to scroll. Is there any way to make the first two columns permanent??
I have looked around and can't seem to come up with any answer besides
putting them in seperate JScrollPanes, but I want the scroll bar to
span the entire Pane.
Thank you ahead for any help,
Ray
Daniel Pitts - 13 Mar 2007 01:20 GMT
On Mar 12, 1:57 pm, "Ray.Jarami...@gmail.com"
<Ray.Jarami...@gmail.com> wrote:
> I have a JTable in a JScrollPane but I do not want the first two
> colums to scroll when I move the scroll bar. I want the first two
[quoted text clipped - 7 lines]
>
> Ray
I'm not quite sure what your asking... Perhaps you want two tables,
one that scrolls and one that doesn't?
JPanel panel = new JPanel();
panel.setLayout(new BorderLayout());
panel.add(permanentTable, BorderLayout.WEST);
panel.add(new JScrollPane(scrollingTable), BorderLayout.CENTER);
Joshua Cranmer - 13 Mar 2007 03:09 GMT
> I have a JTable in a JScrollPane but I do not want the first two
> colums to scroll when I move the scroll bar. I want the first two
[quoted text clipped - 7 lines]
>
> Ray
Somewhere in the JTable class, there is a protected method that prepares
the table for a scroll pane (something along the lines of
prepareTable()). If you fiddle with that and ColumnModels, you should be
able to get what you want.