Win a copy of TensorFlow 2.0 in Action this week in the Artificial Intelligence and Machine Learning forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Paul Clapham
  • Bear Bibeault
  • Jeanne Boyarsky
Sheriffs:
  • Ron McLeod
  • Tim Cooke
  • Devaka Cooray
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Jj Roberts
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • salvin francis
  • Scott Selikoff
  • fred rosenberger

about JScrollPanes and rowHeaders

 
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.
 
Bartender
Posts: 825
5
Python Ruby Java
  • 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"?
 
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
 
Bartender
Posts: 5167
11
Netbeans IDE Opera Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You could see how Rob Camick does it: Fixed Column Table.
 
The only taste of success some people get is to take a bite out of you. Or this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
reply
    Bookmark Topic Watch Topic
  • New Topic