just looking for a quick answer: is it possible to use a JTable as a JScrollPane’s columnHeader?
I have a configed JTable with different column width and column title, and plan to use the header as the columnHeader of a scrollpane. How can I achieve this? I set the table with
scrollPane.setColumnHeaderView(table);
but it doesn’t show up.
so thanks to Guillaume Polet, it should be
scrollpane.setColumnHeaderView(table.getTableHeader());
but all the columns have the same width now although I set them with different values in my table. How could I let the table columns show different width?
If I understand you correctly, you want the column headers of your table to appear in the column headers of the viewport but you want something else in the viewport view?
Then you need to grab the table header and set it as the column header of the viewport.
Here is an example: