如何在JTable中查看列标签? [英] How to see column labels in JTable?
本文介绍了如何在JTable中查看列标签?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有如下代码:
table_1 = new JTable();
table_1.setModel(new DefaultTableModel(
new Object[][] {
{null, null, null, null, null, null, null},
},
new String[] {
"Product Code", "Description", "Price", "Quantity", "Total ", "Discount", "Remarks"
}
));
我想查看列标题名称.我尝试使用此代码,但看不到名称.我想知道该怎么做?
I want to see column header names. I tried with this code, but I cant see the names. I want to know how to do that?
此外,我还想设置来自JTextField
的单元格值.
Also, I also want to set the cell value which is coming from a JTextField
.
推荐答案
在将table_1
添加到JScrollPane
之前,列名不会显示,就像它们在
The column names won't show up until you add table_1
to a JScrollPane
, like they show in the tutorial.
这篇关于如何在JTable中查看列标签?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文