Вопрос

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?

Это было полезно?

Решение

Do this INTEGER.parseInt(getvalueat(2,4)); this should be able to allow you to put it into an int

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top