• Post Reply Bookmark Topic Watch Topic
  • New Topic

JTable - editable columns

 
Bodhi Karam
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello everybody,

Can somebody tell me, how to use this code to allow or to disable editing
different columns, if it is possible?

(this code is taken from http://www.javaalmanac.com/egs/javax.swing.table/NoEdit.html )

JTable table1 = new JTable() {
public boolean isCellEditable(int rowIndex, int vColIndex) {
return false;
}
};


OK, I already found the answer, I think.

confModel = new DefaultTableModel(new Vector(), new Vector());
JTable confTable = new JTable(confModel){
public boolean isCellEditable(int rowIndex, int colIndex) {
if (colIndex < 2) {
return false;
} else {
return true;
}
}
};
[ May 12, 2006: Message edited by: Bodhi Karam ]
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!