TableColumn: setPreferredWidth(int preferredWidth)
import javax.swing.JTable;
import javax.swing.table.TableColumn;
public class Main {
public static void main(String[] argv) throws Exception {
int rows = 3;
int cols = 3;
JTable table = new JTable(rows, cols);
TableColumn col = table.getColumnModel().getColumn(0);
col.setMinWidth(100);
col.setMaxWidth(100);
col.setPreferredWidth(100);
}
}
Related examples in the same category