I am wondering if the following is possible and if it is how to do it. I would like to remove or hide or disable selection of the "empty" cell from my table:
The following is the code that sets the table model, after this code I just populate the table with data:
myTable.setModel(new javax.swing.table.DefaultTableModel(
new Object[][]{
{null, null, null},
{null, null, null},
{null, null, null},
{null, null, null},
{null, null, null},
{null, null, null},
{null, null, null}
},
new String[]{
null, null, null
}) {
Class[] types = new Class[]{
java.lang.String.class, java.lang.String.class, java.lang.String.class
};
boolean[] canEdit = new boolean[]{
false, false, false
};
@Override
public Class getColumnClass(int columnIndex) {
return types[columnIndex];
}
@Override
public boolean isCellEditable(int rowIndex, int columnIndex) {
return canEdit[columnIndex];
}
});