Custom Jtable column widths in netbeans
Is it related to using the Swing GUI Builder (formerly Project Matisse) in NetBeans, or manual table creation when using the NetBeans IDE?
JTable TableColumnModel Table. The column widths of a column are usually controlled by setting its preferred width . Depending on the layout, you can change the minWidth and maxWidth fields in the TableColumn.
If you are using the Swing GUI builder you can call this after initComponents () in the constructor of the support panel, or if you are using static data in design mode you can right click on the table, select Table Contents and set the width when adding columns using the Customizer dialog box. There is also a "Customize Code" option in design mode to modify fragments of the initComponents method managed by the IDE.
Setting the width manually after initComponents () might be the easiest and least magical initially.
public MyPanel() {
initComponents();
TableColumn col = table.getColumnModel().getColumn(0);
col.setPreferredWidth(100);
}
Note. I am referring to NetBeans IDE 6.8, as I answered this, the menu items and dialogs may differ.
a source to share