Do this INTEGER.parseInt(getvalueat(2,4)); this should be able to allow you to put it into an int
Get integer value from JTable
Pergunta
In my JTable i have 4 columns where last 3 columns are set as integer. I used netbeans Table Contents to change the column type from Object
to Integer
I also initialized
jTable1.getModel().getColumnClass(1);
jTable1.getModel().getColumnClass(2);
and to retrieve the value i used getValueAt
int qty=(int)jTable1.getValueAt(row, 1);
int amt=(int)jTable1.getValueAt(row, 2);
But it's showing this error
java.lang.String cannot be cast to java.lang.Integer
What I'm missing here? Can anyone suggest?
Solução
Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow