Hugo Assanti
Hugo Assanti

Reputation: 421

How to retrieve header values from JTable

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

Upvotes: 11

Views: 13035

Answers (2)

Vincze Gergely
Vincze Gergely

Reputation: 31

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()

Upvotes: 3

Guillaume
Guillaume

Reputation: 14671

With the getColumnName(int) method

jTable.getColumnName(columnIndex)

Upvotes: 9

Related Questions