I have a JXTable that is created like this:
JScrollPane scrollPane = new JScrollPane();
contentPanel.add(scrollPane, BorderLayout.CENTER);
tbl = new JXTable();
tbl.setColumnSelectionAllowed(true);
tbl.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
tbl.setEditable(false);
scrollPane.setViewportView(tbl);
The problem is that when it gets filled, all the columns are squashed to fit into the table. I expected the columns to be adjusted according to the width of the column header or column value (which ever is broader) and then for a horizontal scroll bar to be displayed that will enable me to scroll left or right.
How do I bridge this problem?