When creating a JTable, a JScrollPane accompanies it in many cases. However, there may be times where you do not want the JTable added to the JScrollPane.

The problem I encountered was finding out the JTableHeader could not be seen. I am not sure if there is a solution to this but what I did was to get a reference to the JTableHeader and add it as another component on top of the JTable.

Add both the JTable and JTableHeader in a container like JPanel and set its layout to BorderLayout. See example.

That should make it display those table headers.

Related Posts Plugin for WordPress, Blogger...