默认表模型可编辑 [英] default table model editable
本文介绍了默认表模型可编辑的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
关于jtable和默认表模型,我有两个问题
I have two questions about jtable and default table model
JTable table = new JTable();
TableModel model = new DefaultTableModel(colNames,rowcount);
table.setModel(model);
- 我在第4列中添加了comboBox,只有第4列应该是可编辑的,其余的则应该是不可编辑的.如何仅使第4列可编辑?
- 该表的行来自ms访问表,因此,如果更改了comboBox,我也想在ms访问表中对其进行更新.如何更新ms访问表中的数据?
推荐答案
您将需要执行几个步骤:
You'll need to proceed in several steps:
-
以
如何使用表 .
此示例说明了此示例显示了如何覆盖setValueAt()
,您可以使用从中更新数据库. href ="http://docs.oracle.com/javase/tutorial/jdbc/index.html" rel ="nofollow noreferrer"> JDBC .
This example shows how to override setValueAt()
, from which you can update your database using JDBC.
一旦您了解了这些概念,请考虑 DbUtils
.
Once you understand these concepts, consider DbUtils
.
这篇关于默认表模型可编辑的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文