5 个解决方案
#1
晕~自己up
#2
update your tablemodel.
JTable.setValueAt
JTable.setValueAt
#3
JTable.setValueAt(Object value, int nRow, int nCol);value指的是什么?
如果(0,0)原来是1,我现在把它该成6,当我点击保存按纽时,怎么把6取出来?
如果(0,0)原来是1,我现在把它该成6,当我点击保存按纽时,怎么把6取出来?
#4
//button is your 保存按纽;
button.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent e){
int row=table.getSelectedRow();
int col=table.getSelectedColumn();
table.getCellEditor(row,col).stopCellEditing();
//以下两行测试 Model 已经改变
Object o=table.getValueAt(row,col);
System.out.println(o);
}
});
button.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent e){
int row=table.getSelectedRow();
int col=table.getSelectedColumn();
table.getCellEditor(row,col).stopCellEditing();
//以下两行测试 Model 已经改变
Object o=table.getValueAt(row,col);
System.out.println(o);
}
});
#5
谢谢~
#1
晕~自己up
#2
update your tablemodel.
JTable.setValueAt
JTable.setValueAt
#3
JTable.setValueAt(Object value, int nRow, int nCol);value指的是什么?
如果(0,0)原来是1,我现在把它该成6,当我点击保存按纽时,怎么把6取出来?
如果(0,0)原来是1,我现在把它该成6,当我点击保存按纽时,怎么把6取出来?
#4
//button is your 保存按纽;
button.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent e){
int row=table.getSelectedRow();
int col=table.getSelectedColumn();
table.getCellEditor(row,col).stopCellEditing();
//以下两行测试 Model 已经改变
Object o=table.getValueAt(row,col);
System.out.println(o);
}
});
button.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent e){
int row=table.getSelectedRow();
int col=table.getSelectedColumn();
table.getCellEditor(row,col).stopCellEditing();
//以下两行测试 Model 已经改变
Object o=table.getValueAt(row,col);
System.out.println(o);
}
});
#5
谢谢~