aspose file tools*
The moose likes Swing / AWT / SWT and the fly likes about JScrollPanes and rowHeaders Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "about JScrollPanes and rowHeaders" Watch "about JScrollPanes and rowHeaders" New topic
Author

about JScrollPanes and rowHeaders

Jhedzkie Skies
Ranch Hand

Joined: Oct 28, 2009
Posts: 118
Hi.
I'm working on JTable and database when I've encountered this issue, when I wanted to freeze the first columns of my JTable that contains names and similar information.
When I tried and asked our bestfriend google how to do it, he told me to use JScrollPane's setRowHeaderView(Component view) method, which pretty much deals with my situation.
I managed to setup two different tables and yeah, its cool. However, I noticed that the JTable I've set as the component of the RowHeaderView doesn't display its Column Headers and only displays gray.
Is there any way where I can make its Column Headers appear? Or do I have to look for some other ways to implement freezing of JTable columns?

Thanks in advanced.
Kemal Sokolovic
Bartender

Joined: Jun 19, 2010
Posts: 825
    
    5

Jhedzkie Skies wrote:Or do I have to look for some other ways to implement freezing of JTable columns?


What do you mean by "freezing of JTable columns"?


The quieter you are, the more you are able to hear.
Michael Dunn
Ranch Hand

Joined: Jun 09, 2003
Posts: 4632
> What do you mean by "freezing of JTable columns"?

similar to Excel's 'freeze panes'

@OP
from memory, you'd create 2 tables:
table1 has only a single column, goes in BorderLayout.WEST (will have default header 'A')
table2 has all the rest, with column 0 removed, in BorderLayout.CENTER (default headers 'B' to whatever)
a bit of sync-ing the scrollbar and selection models and it should work fine
Darryl Burke
Bartender

Joined: May 03, 2008
Posts: 4642
    
    5

You could see how Rob Camick does it: Fixed Column Table.


luck, db
There are no new questions, but there may be new answers.
 
jQuery in Action, 2nd edition
 
subject: about JScrollPanes and rowHeaders