Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Java > JTable scrolling issue

Reply
Thread Tools

JTable scrolling issue

 
 
Ray.Jaramillo@gmail.com
Guest
Posts: n/a
 
      03-12-2007
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

 
Reply With Quote
 
 
 
 
Daniel Pitts
Guest
Posts: n/a
 
      03-13-2007
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
> 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


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);

 
Reply With Quote
 
 
 
 
Joshua Cranmer
Guest
Posts: n/a
 
      03-13-2007
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
> 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
>

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.
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
smooth scrolling & auto scrolling sillyputty Firefox 1 08-24-2007 02:10 AM
Putting a JTable inside a JTable cell? Tivo Escobar Java 1 04-12-2007 11:09 AM
How to move data from a CSV file to a JTable, and from a JTable to a CSV file ? Tintin92 Java 1 02-14-2007 06:51 PM
Jtable row/cell/column selection issue apattin Java 2 04-28-2006 04:24 PM
scrolling issue jenv Computer Support 3 01-25-2004 07:33 PM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57