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?

  1. Columns are still resizable by the user
  2. 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

Popular posts from this blog

c# - sqlDecimal to decimal clr stored procedure Unable to cast object of type 'System.Data.SqlTypes.SqlDecimal' to type 'System.IConvertible' -

Calling GetGUIThreadInfo from Outlook VBA -

Obfuscating Python code? -