Custom Column width in JTable in Java Swings Netbeans

Last modified date

Each column is having specific width in my visualization case, just add the line of code and set your width

enjoy cheers

Custom-Column-size-for-JTable-in-Java-Swings-Netbeans

table.getColumnModel().getColumn(1).setPreferredWidth(200);
table.getColumnModel().getColumn(2).setPreferredWidth(200);
table.getColumnModel().getColumn(3).setPreferredWidth(50);
table.getColumnModel().getColumn(4).setPreferredWidth(80);
table.getColumnModel().getColumn(5).setPreferredWidth(80);
table.getColumnModel().getColumn(6).setPreferredWidth(100);
table.getColumnModel().getColumn(7).setPreferredWidth(100);
table.getColumnModel().getColumn(8).setPreferredWidth(50);
table.getColumnModel().getColumn(9).setPreferredWidth(100);
table.getColumnModel().getColumn(10).setPreferredWidth(100);

 

intactabode