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
要获取单元格值,您可以执行类似的操作
table.getModel().getValueAt(rowIndex, columnIndex)
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.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.