?
Solved

Java Swing: Retrieve value of cell in header

Posted on 2011-09-11
8
Medium Priority
?
215 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 2000 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
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 

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

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

INTRODUCTION Working with files is a moderately common task in Java.  For most projects hard coding the file names, using parameters in configuration files, or using command-line arguments is sufficient.   However, when your application has vi…
In this post we will learn how to make Android Gesture Tutorial and give different functionality whenever a user Touch or Scroll android screen.
Viewers learn about the third conditional statement “else if” and use it in an example program. Then additional information about conditional statements is provided, covering the topic thoroughly. Viewers learn about the third conditional statement …
Viewers will learn about if statements in Java and their use The if statement: The condition required to create an if statement: Variations of if statements: An example using if statements:
Suggested Courses
Course of the Month12 days, 15 hours left to enroll

777 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