• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 223
  • Last Modified:

Java Swing: Retrieve value of cell in header

Please let me know how i can retrieve the value of a particular cell in the header of a JTable.

Thanks!
0
dshrenik
Asked:
dshrenik
  • 6
  • 2
1 Solution
 
for_yanCommented:
What means the value of the cell in the header?
Do you mean colunmn name?
0
 
dshrenikAuthor Commented:
Right.
0
 
dshrenikAuthor Commented:
I want to retrieve the name of column, given the column number.
0
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 
dshrenikAuthor Commented:
This code is causing exceptions:
0
 
dshrenikAuthor Commented:
String a = table.getColumn(column).getHeaderValue().toString();
0
 
dshrenikAuthor Commented:
This seems to do the trick:
String columnName = table.getTableHeader().getColumnModel().getColumn(column).getHeaderValue().toString();

Open in new window

0
 
for_yanCommented:
But I think
Jtable table;
table.getCoulmName(int column)
should also return column name
0
 
dshrenikAuthor Commented:
It does. Thanks!
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

  • 6
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now