JTableHeader: resizeAndRepaint() : JTableHeader « javax.swing « Java by API






JTableHeader: resizeAndRepaint()

  


import javax.swing.JTable;
import javax.swing.table.DefaultTableModel;

public class Main {
  public static void main(String[] argv) throws Exception {
    DefaultTableModel model = new DefaultTableModel();
    JTable table = new JTable(model);
    model.addColumn("Col1");
    model.addColumn("Col2");

    table.getColumnModel().getColumn(0).setHeaderValue("New Name");
    table.getTableHeader().resizeAndRepaint();

  }
}   

   
    
  








Related examples in the same category

1.JTableHeader: setReorderingAllowed(boolean reorderingAllowed)
2.JTableHeader: setResizingAllowed(boolean resizingAllowed)