[英]get edited value of cell in JTable after a button clicked
当我点击名为“save”的按钮时,如何在我的JTable中获取单元格的编辑值?
New value can be get from the DefaultCellEditor
. 可以从
DefaultCellEditor
获取新值。
button.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
if (table.getCellEditor() != null) {
DefaultCellEditor cellEditor = (DefaultCellEditor) table.getCellEditor();
String value = ((JTextField) cellEditor.getComponent()).getText();
}
}
});
也许这应该可以帮助你: 表格单元格监听器
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.