且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

动态更改JTable中的列标题文本

更新时间:2023-12-04 14:41:58

您可以直接更新TableColumnModel:

You can update the TableColumnModel directly:

JTableHeader th = table.getTableHeader();
TableColumnModel tcm = th.getColumnModel();
TableColumn tc = tcm.getColumn(0);
tc.setHeaderValue( "???" );
th.repaint();