Table model specified column is not editable

Riga class attribute boolean flag, then add a new row, change the value of this tag, this tag determination method is performed when editing cell

 

https://blog.csdn.net/gaowen_han/article/details/7738654

 

tableModel.addTableModelListener (TableModelListener new new () {
public void a tableChanged (TableModelEvent is E) {
int type = e.getType (); // get the event type
int row = e.getFirstRow () + 1 ; // get the triggering event the table row index
int column = e.getColumn () + 1 ; // get table column index triggered the incident
if (type == TableModelEvent.INSERT) {// determine whether to insert a row trigger
// determine whether modifications line trigger
} iF the else (of the type == TableModelEvent.UPDATE) {
// determine whether there is a trigger delete the row
} else if (type == TableModelEvent.DELETE) {

} else {

}
}
});

 

 

// Create a table model object
tableModel = new DefaultTableModel (rowValues, columnNames ) {

@Override

public boolean isCellEditable(int row, int column) {

if ( column == 1 || column == 7) {

return false;

} else {

return true;
}
}

};

 

Java Swing JTable table [12: Description for the cell specified text form]

 

http://www.doc88.com/p-0347330521004.html

https://blog.csdn.net/gaowen_han/article/details/7738654

 

Java uses a custom tableModel, setting editing

http://www.doc88.com/p-0347330521004.html

Java Swing JTable table [12: Description for the cell specified text form]

https://blog.csdn.net/zp357252539/article/details/50500225

Guess you like

Origin www.cnblogs.com/xf680912/p/11317696.html