java - How can I keep columns of a JTable from resizing when I resize the JFrame? -
This code puts JTable in JFrame (the only component of the entire UI):
GeFame Frame = New Geoffram ("title"); Frame.setDefaultCloseOperation (JFrame.EXIT_ON_CLOSE); Jettbable Table = Appenders. CentTable (); JScrollPane scrollPane = new JScrollPane (table); Table.setFillsViewportHeight (true); Frame.getContentPane () Add (ScrollPan, BorderLayout.CENTER); Frame.pack (); Frame.setVisible (true);
I also have some code to set the preferred size of the column.
No fancy. When the UI opens, then the table takes the whole scene and I do not have any scroll bar, the combined preferred width of the column requires more horizontal space because the windows are wide. Despite this, there is no horizontal scroll bar and columns are very narrow.
What do I have to do?
- Columns are still resizable by the user
- Respect the current width? To wit. When I change the width of a column, then the width of the other column should not be changed.
table.SetOtO resismode (JT.A.ToOOSISISSEFF);
You can also add scrollable scroll in JPNL and then add panel to frame. In this way the panel will change to size, not scrollpane.
Comments
Post a Comment