Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / March 2007

Tip: Looking for answers? Try searching our database.

JTable scrolling issue

Thread view: 
Ray.Jaramillo@gmail.com - 12 Mar 2007 21:57 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
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.


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.