Mega Code Archive
Packing a Column of a JTable Component according to the header text
import java.awt.Component;
import javax.swing.JFrame;
import javax.swing.JScrollPane;
import javax.swing.JTable;
import javax.swing.table.DefaultTableColumnModel;
import javax.swing.table.TableCellRenderer;
import javax.swing.table.TableColumn;
public class Main {
public Main() {
JTable table = new JTable(3, 3);
table.setAutoResizeMode(JTable.AUTO_RESIZE_OFF);
for(int i=0;i