Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

about JScrollPanes and rowHeaders

 
Aron Jhed Amiscosa
Ranch Hand
Posts: 118
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 825
5
Java Python Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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"?
 
Michael Dunn
Ranch Hand
Posts: 4632
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
> 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
Posts: 5125
11
Java Netbeans IDE Opera
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You could see how Rob Camick does it: Fixed Column Table.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic