继承JTable,覆写isCellEditable(int row, int col)方法public boolean isCellEditable(int row, int col) {
if(row==y)return false;
if(col==x)return false;
if(row==y && col==x)return false;
}
if(row==y)return false;
if(col==x)return false;
if(row==y && col==x)return false;
}
解决方案 »
- struts2 中 session 问题
- JAVA EE 掌握程度的问题
- 向数据库插入一样数据。 但是数据库里却出现 数据相同的二行。
- 请教关于获取xml某一节点下子节点个数的问题。
- struts中el的内置标签的问题
- webservice开发流程
- XPATH出错,帮忙看看~~java.lang.NoClassDefFoundError: org/jaxen/JaxenException
- 又是邮件中文问题!!!
- 在线等高手回答.
- 100分!100分!100分!100分!求.csv文件导入代码?
- tomcat配置的若干问题的求教!!!请高手赐教!!!小弟不胜感激
- 为什么我的Tomcat5.0.28装不上?
public boolean isCellEditable(int row, int col) {
//Note that the data/cell address is constant,
//no matter where the cell appears onscreen.
if (row == 你要不可编辑的行的标识) {
return false;
} else {
return true;
}
}
public boolean isCellEditable(int row, int col) {
//Note that the data/cell address is constant,
//no matter where the cell appears onscreen.
return 你想返回的是否某行某列可否Edit }
还有其他方法要继承重写,如
public int getColumnCount() {
return 2;
} public int getRowCount() {
return data[0].length;
} public String getColumnName(int col) {
return " ";
} public Object getValueAt(int row, int col) {
return data[col][row];
}}
==方法都是构造这个Table的中数据的方法,其实你开发JTable一般来说就应该写这个Model来控制数据和Render以及Editor的控制,相关技术还有不明可以继续问。
public boolean isCellEditable(int row, int col) {
if(row==x)
return false;
return true;
}