Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to retrieve header values from JTable

Tags:

java

swing

jtable

How can I retrieve the header values from a JTable? Thanks.

like image 948
Hugo Assanti Avatar asked Oct 05 '10 19:10

Hugo Assanti


2 Answers

With the getColumnName(int) method

jTable.getColumnName(columnIndex)
like image 131
Guillaume Avatar answered Oct 05 '22 01:10

Guillaume


It is not obvious that the Column name and the header name are the same. To get the header name: jTable1.getColumnModel().getColumn(i).getHeaderValue()

like image 33
Vincze Gergely Avatar answered Oct 05 '22 01:10

Vincze Gergely