문제

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.

도움이 되었습니까?

해결책

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

다른 팁

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

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top