如何设置JTable的行标题、列标题?

如下所示:A1 A2 A3 A4 A5...B1 * * * * * B2 * * * * *B3 * * * * *B4 * * * * *
2024-11-17 21:31:23
推荐回答(2个)
回答1:

给你段代码。可以改抬头名,在初次载入时用
此函数用于购建表格台头部分
public String[] jtableTitle() {
int i;
String[] jtableTitle = new String[i];
/** 'i' means you will create table's column amount */
stringUser[0] = "TableColumn1";
stringUser[1] = "TableColumn2";
.......
stringUser[i-1] = "TableColumni-1";
return jtableTitle;
}

回答2:

仍是继承 AbstractTableModel 呗
只不过 要自己维护 第一列的值而已啊