Reputation: 31
I have a jtable with column item,quantity,rate and amount.If i enter value in quantity and press tab key the total amount is getting calculated that is working fine.But i need the amount to be calculated on typing the quantity. I want it to be done on key pressed of numbers or on typing number.I have used default jtable using netbeans
Upvotes: 0
Views: 11040
Reputation: 205785
In response to an answer suggesting getValueAt()
, you say, "I used the above code but it prints as null
." As discussed here, the value is not available in the model until the editor concludes. You'll need a custom TableCellEditor
that uses a DocumentListener
to update your total.
Upvotes: 3
Reputation: 5399
to get cell value you can to do something like that
table.getModel().getValueAt(rowIndex, columnIndex)
Upvotes: 3