jtable中的内容改变了会触发什么事件?
还有怎么把table中的改变存入database?是不是通过改变resultSet中的内容?
还有怎么把table中的改变存入database?是不是通过改变resultSet中的内容?
解决方案 »
- 下面代码怎么写成伪代码啊
- Java se 流的相关问题
- 想不通一些关于循环的问题(初学)
- Jar文件 如何设置运行时JVM
- window.top iframe使用例子
- 跪求高人指点小菜鸟java applet中访问access数据库问题
- (100分)JAVA纸牌游戏中排面的移动怎么实现?
- package city;产生了好多目录,真弄不明白??????????
- Java有类似于微软的MSDN得东东吗?
- 有哪位大虾告诉我一下?怎么设置PATH 和 CLASSPATH?我不能再为这个小问题纠缠下去了!!!
- 各位大虾帮忙看看(:异常问题:)
- Runtime.getRuntime().exec()怎么样,可以执行JAR包里面的程序
If you have a class such as SimpleTableDemo that isn't a table or table model, but needs to react to changes in a table model, then you need to do something special to find out when the user edits the table's data. Specifically, you need to register a TableModelListener on the table model. Adding the bold code in the following snippet makes SimpleTableDemo react to table data changes. import javax.swing.event.*;
import javax.swing.table.TableModel;public class SimpleTableDemo ... implements TableModelListener {
...
public SimpleTableDemo() {
...
table.getModel().addTableModelListener(this);
...
} public void tableChanged(TableModelEvent e) {
int row = e.getFirstRow();
int column = e.getColumn();
TableModel model = (TableModel)e.getSource();
String columnName = model.getColumnName(column);
Object data = model.getValueAt(row, column); ...// Do something with the data...
}
...
}