I have made a table with my own model so cells are not editable
String[] colNames = {"Barcode","Name","Exp Date"};
String[][] rowInfo = new String[mainSuper.getProductVector().size()][3];
Iterator<Product> itr=mainSuper.getProductVector().iterator();
int i=0;
Product temp;
while(itr.hasNext()){
temp= itr.next();
rowInfo[i][0]=temp.getBarcode();
rowInfo[i][1]=temp.getName();
if (temp.getExpDate()==null) {
rowInfo[i][2]="None";
}else{
rowInfo[i][2]=temp.getExpDate().toString();
}
i++;
}
prodTable=new JTable(rowInfo, colNames){
private static final long serialVersionUID = 1L;
public boolean isCellEditable(int row, int column) {
return false;
}
};
I am trying to make a button that will delete the selected row in the table (only one row can be selected) but I am having trouble making it work. I tried a few solution from the site but none of them worked. thanks for the help.