Getting JTable value as integer?
I do not understand; I am using DefaultTableModel
and my attempt was to get the value in the table as int
:
Integer.parseInt( tableModel.getValueAt(i, 1) );
Eclipse states that there is a need to render from Object
to String
, so eclipse does this:
Integer.parseInt( (String) tableModel.getValueAt(i, 1) );
The program crashes at runtime because it is impossible to pass "int to string". What for? I was expecting "object -> string -> int".
+3
source to share
2 answers