Topic: 请问jtable如何设置成不能编辑? |
Print this page |
1.请问jtable如何设置成不能编辑? | Copy to clipboard |
Posted by: shsen Posted on: 2003-04-02 10:55 谢谢! |
2.Re:请问jtable如何设置成不能编辑? [Re: shsen] | Copy to clipboard |
Posted by: diystar Posted on: 2003-04-02 14:25 覆盖TableModel中的方法 public boolean isCellEditable(int row, int column) {return false;} |
3.Re:请问jtable如何设置成不能编辑? [Re: shsen] | Copy to clipboard |
Posted by: shsen Posted on: 2003-04-03 17:23 怎么覆盖啊? 比如: JTable table = new JTable(); 然后怎么使table里的所有格子都不能编辑? |
4.Re:请问jtable如何设置成不能编辑? [Re: shsen] | Copy to clipboard |
Posted by: looker Posted on: 2003-04-03 19:52 1.defined a TableModel named CustomTableModel which extends DefaultTableModel 2. override the method public boolean isCellEditable(int row, int column) you can define any cell to make it uneditable 3. create a instance of CustomTableModel 4. set this instnce to JTable |
5.Re:请问jtable如何设置成不能编辑? [Re: shsen] | Copy to clipboard |
Posted by: yamakasy Posted on: 2003-04-03 23:27 没错,可以稍微看一下MVC模式,Delegate模式和它在swing中的实现,你会得到满意的答案。 |
6.Re:请问jtable如何设置成不能编辑? [Re: shsen] | Copy to clipboard |
Posted by: shsen Posted on: 2003-04-04 10:26 是不是这样: class CustomTableModel extends DefaultTableModel { public boolean isCellEditable(int row, int column) { return false; } } 然后如何定义变量?而且我的jtable要用new jtable(row,col);生成。 |
7.Re:请问jtable如何设置成不能编辑? [Re: shsen] | Copy to clipboard |
Posted by: shsen Posted on: 2003-04-04 11:27 解决了,谢谢。 |
Powered by Jute Powerful Forum® Version Jute 1.5.6 Ent Copyright © 2002-2021 Cjsdn Team. All Righits Reserved. 闽ICP备05005120号-1 客服电话 18559299278 客服信箱 714923@qq.com 客服QQ 714923 |