AbstractTable model exception throws clause error?
I want to display a JDialog whenever the user tries to enter a string when the column class is Double. To do this, I am trying to throw an exception from the setValueAt() method in my class that extends AbstractTable model. However, my code results in an "Exception StatisticsException is not compatible with throws clause in AbstractTableModel.setValueAt()". Any idea how I can work around this? Is there a better way to display a JDialog in this case? Thanks in advance.
publicvoid setValueAt(Object text,int rowIndex,int columnIndex)throws StatisticsException{
if(variables[columnIndex].isDouble()){
try{
Double.parseDouble(text.toString());
Object[] temp = data.get(rowIndex);
temp[columnIndex] = text.toString();
data.remove(rowIndex);
data.add(rowIndex, temp);
}catch(NumberFormatException ex){
thrownew StatisticsException("Numeric value required.");
}
}else{
Object[] temp = data.get(rowIndex);
temp[columnIndex] = text.toString();
data.remove(rowIndex);
data.add(rowIndex, temp);
}
}

