sap*_*Pro 6 java user-interface swing jtable
如何JTable在使用netbeans时添加数据.Netbeans在它的后代码中是这样的:
jTable1 = new javax.swing.JTable();
jTable1.setModel(new javax.swing.table.DefaultTableModel(
new Object [][] {
{null, null},
{null, null},
{null, null},
{null, null}
},
new String [] {
"Name", "Branch"
}
) {
boolean[] canEdit = new boolean [] {
false, false
};
public boolean isCellEditable(int rowIndex, int columnIndex) {
return canEdit [columnIndex];
}
}); // THIS IS THE SNIPPET GENERATED BY NETBEANS
//( I have already created a table using the drag and drop fetaure of netbeans and this is the back snippet generated)
Run Code Online (Sandbox Code Playgroud)
2-D对象数组和String数组具有本地访问权限,因此当我想要在程序中间时,我无法使用它来填充它.(在某些功能中)
就像在上表中我将在某些功能中添加名称和分支.但我该怎么做?
任何人都可以告诉我可以将数据添加到JTable吗?
Eri*_*ick 18
jTable1.getModel().setValueAt(value, row, column);
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
48763 次 |
| 最近记录: |