Question 1) I have a JPanel ps, which has a null layout; a JScrolPane scrollPane, and a JTable table. I have added the table to the scrollPane, and then added the scrollPane to the Jpanel ps. The following is my code for doing that:-
ps = new JPanel();
ps.setLayout(null);
ps.setSize(1000,600);
scrollPane = new JScrollPane();
scrollPane.setBounds(10, 119, 975, 300);
scrollPane.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS);
ps.add(scrollPane);
table = new JTable(data, columns);
table.setAutoResizeMode(JTable.AUTO_RESIZE_OFF);
scrollPane.setViewportView(table);
It is supposed t create a scrollPane with horizontal scrollbars, and when the number of columns increases in such a way that, it cannot be handled on a single screen, the scrollbar helps to display the contents. See "AUTO_RESIZE_OFF".
But what happens is that, the the size of all the columns is fixed (I don't know how many characters. The width of all of them is same.). The name of the columns is thus not fully viewable.
My question is, is it possible to increase the width of the column shown, or to show all the columns with their own width ? Also, how to enable scrolling ?