Solved

Java Swing: Retrieve value of cell in header

Posted on 2011-09-11
8
211 Views
Last Modified: 2012-05-12
Please let me know how i can retrieve the value of a particular cell in the header of a JTable.

Thanks!
0
Comment
Question by:dshrenik
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 6
  • 2
8 Comments
 
LVL 47

Accepted Solution

by:
for_yan earned 500 total points
ID: 36519812
What means the value of the cell in the header?
Do you mean colunmn name?
0
 

Author Comment

by:dshrenik
ID: 36519820
Right.
0
 

Author Comment

by:dshrenik
ID: 36519837
I want to retrieve the name of column, given the column number.
0
PeopleSoft Has Never Been Easier

PeopleSoft Adoption Made Smooth & Simple!

On-The-Job Training Is made Intuitive & Easy With WalkMe's On-Screen Guidance Tool.  Claim Your Free WalkMe Account Now

 

Author Comment

by:dshrenik
ID: 36519840
This code is causing exceptions:
0
 

Author Comment

by:dshrenik
ID: 36519842
String a = table.getColumn(column).getHeaderValue().toString();
0
 

Author Comment

by:dshrenik
ID: 36519861
This seems to do the trick:
String columnName = table.getTableHeader().getColumnModel().getColumn(column).getHeaderValue().toString();

Open in new window

0
 
LVL 47

Expert Comment

by:for_yan
ID: 36519880
But I think
Jtable table;
table.getCoulmName(int column)
should also return column name
0
 

Author Comment

by:dshrenik
ID: 36519882
It does. Thanks!
0

Featured Post

SharePoint Admin?

Enable Your Employees To Focus On The Core With Intuitive Onscreen Guidance That is With You At The Moment of Need.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This was posted to the Netbeans forum a Feb, 2010 and I also sent it to Verisign. Who didn't help much in my struggles to get my application signed. ------------------------- Start The idea here is to target your cell phones with the correct…
Java Flight Recorder and Java Mission Control together create a complete tool chain to continuously collect low level and detailed runtime information enabling after-the-fact incident analysis. Java Flight Recorder is a profiling and event collectio…
Viewers learn about the “for” loop and how it works in Java. By comparing it to the while loop learned before, viewers can make the transition easily. You will learn about the formatting of the for loop as we write a program that prints even numbers…
This tutorial explains how to use the VisualVM tool for the Java platform application. This video goes into detail on the Threads, Sampler, and Profiler tabs.

730 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question