简体   繁体   中英

Getting values from JTable cell

I made a column editable in Jtable.

I want old values from a cell when I have finished editing a cell

You can get the value by using

table.getModel().getValueAt(row_index, col_index);

where table is the name of the table and it will return an Object

Go through this Getting cell value . It may be useful for you.

You can use a TableCellListener , like they show here . It uses a PropertyChangeEvent to keep track of the old and new values.

您还可以创建自己的TableModel实现,并覆盖setValueAt方法以跟踪更改。

Add a TableModelListener to your TableModel. Whenever an event fires you can updated the contents of your text field with the new value in the cell.

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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM