umn index error: ngetted index= + ColumnIndex + , nmost admissible index= + (GetColumnCount () - 1);
}
@ Override
public int getRowCount () {
return containers. size ();
}
@ Override
public Object getValueAt ( int rowIndex, int columnIndex) {c=containers. get (rowIndex);
switch (columnIndex) {
case 0:
return c. getId ();
case 1:
return c. getVolume ();
case 2:
return c. getCargo ();
}
return null ;
}
@ Override
public boolean isCellEditable ( int rowIndex, int columnIndex) {
switch (columnIndex) {
case 0:
return false ;
case 1:
case 2:
return true ;
}
return false ;
}
@ Override
public void removeTableModelListener (TableModelListener l) {. remove (l);
}
@ Override
public void setValueAt (Object arg0, int rowIndex, int columnIndex) {c=containers. get (rowIndex);
switch (columnIndex) {
case 1 :. setVolume (( int ) arg0);
break ;
case 2 :. setCargo (( int ) arg0);
break ;
}
}
}
class ItemTableModel implements TableModel {
private List lt; Item gt; items;
private Set lt; TableModelListener gt; listeners= new HashSet lt; TableModelListener gt; ();
public ItemTableModel (List lt; Item gt; items) {
this . items=items;
}
@ Override
public void addTableModelListener (TableModelListener l) {. add (l);
}
@ Override
public Class lt ;? gt; getColumnClass ( int columnIndex) {
switch (columnIndex) {
case 0:
return Integer. class ;
case 1:
return Integer. class ;
case 2:
return Integer. class ;
case 3:
return Integer. class ;
case 4:
return Integer. class ;
case 5:
return Integer. class ;
case 6:
return Integer. class ;
case 7:
return Integer. class ;
case 8:
return Double. class ;
case 9:
return String. class ;