自己定义一个类继承DefaultTableModel
然后重载以下方法:
public boolean isCellEditable(int pRow, int pCol) {
return false;
}
就可以了!
只能选择,不能编辑!
然后重载以下方法:
public boolean isCellEditable(int pRow, int pCol) {
return false;
}
就可以了!
只能选择,不能编辑!
解决方案 »
- java中 怎么 获取 昨天的8点??
- JNLP从网页打开后,运行进程无法关闭问题
- 静态属性问题
- 請問這個取數位四舍五入的格式是如何理解."#,##0."
- 小弟初学java想装个jdk但是不知道怎么装和设置环境变量(在linux和win2000中) 请大虾们帮忙!!!
- 开发出一个JAVA应用程序,大家如何发布他在WINOOWS下运行?
- 推荐java入门好书籍,谢谢!
- 帮我看看,jTree的Node 的GetUserObject()方法为什么会出错?
- 走过路过的朋友来看看!
- java中如何运行alter table的语句?
- 关于rose2000的java的逆向工程
- 就没别的办法了?---关于applet,swing,IE
public boolean isCellEditable(int row,
int column)Returns true if the cell at row and column is editable. Otherwise, invoking setValueAt on the cell will have no effect.
Note: The column is specified in the table view's display order, and not in the TableModel's column order. This is an important distinction because as the user rearranges the columns in the table, the column at a given index in the view will change. Meanwhile the user's actions never affect the model's column ordering.Parameters:
row - the row whose value is to be queried
column - the column whose value is to be queried
Returns:
true if the cell is editable
public boolean isCellSelected(int row,
int column)Returns true if the cell at the specified position is selected.
Parameters:
row - the row being queried
column - the column being queried
Returns:
true if the cell at index (row, column) is selected, where the first row and first column are at index 0
isRowSelected
public boolean isRowSelected(int row)Returns true if the row at the specified index is selected.
Returns:
true if the row at index row is selected, where 0 is the first row