ITeye博客

swing 调整table列宽

hzhlu · 2011-09-27 11:25 · swing · 编程语言 · Markdown

/**
 * 调整列宽
 */
private void adjustColumnWidth() {
	// Tweak the appearance of the table by manipulating its column model
	TableColumnModel colmodel = table.getColumnModel();

	// Set column widths
	colmodel.getColumn(0).setPreferredWidth(20);
	colmodel.getColumn(1).setPreferredWidth(20);
	colmodel.getColumn(2).setPreferredWidth(40);
	colmodel.getColumn(3).setPreferredWidth(80);
	colmodel.getColumn(4).setPreferredWidth(200);
	colmodel.getColumn(5).setPreferredWidth(5);
}

评论(0)

暂无评论。

评论功能维护中,当前仅展示历史评论。