Pregunta

I was wondering if any of you knows a good method to get the actual JComponent instance rendering a column header in an existing JTable.

Could not find anything helpful on google, so I came here. :)

I already know that there is a TableCellRenderer interface which delivers the component I want to get, but there is no guarantee that it'll return the same instance every time, so it is more or less useless to me.

Edit:

The goal is to have a possibility to get the Location and size of the component representing a column header dynamically.

And by column header component I mean the instance of the following object:

enter image description here

I really can't post any useful code example, sorry.
Actually any JTable example will do, as the problem refers to the standard Java JTable functionality.

¿Fue útil?

Solución

Rectangle r = table.getTableHeader().getHeaderRect(...);

Otros consejos

Is table.getColumnModel().getColumn(i).getHeaderRenderer() what you are looking for?

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top