jtable cell changed listen

i build a table but i need a listener for any changed for my table, so i could validate at tableMessage was edited by: suryanto_so
[151 byte] By [suryanto_soa] at [2007-11-27 5:18:20]
# 1

If you want to know when the TableModel has been updated you add a TableModelListener to the TableModel:

http://forum.java.sun.com/thread.jspa?forumID=57&threadID=566133

If you want to validate the data that is being edited before it is saved to the TableModel then you use a custom editor:

http://forum.java.sun.com/thread.jspa?forumID=57&threadID=645740

camickra at 2007-7-12 10:41:28 > top of Java-index,Desktop,Core GUI APIs...
# 2
i had try to use tablelistener from your's link, but i don't find away to call stop editing or cancel editing if there is any invalid data, please help me for this one.
suryanto_soa at 2007-7-12 10:41:28 > top of Java-index,Desktop,Core GUI APIs...
# 3

DefaultTableModel tablemodel = new DefaultTableModel(data,column);

tablemodel.addTableModelListener(new InteractiveTableModelListener());

public class InteractiveTableModelListener implements TableModelListener {

public void tableChanged(TableModelEvent evt) {

if (evt.getType() == TableModelEvent.UPDATE) {

}

}

}

nazmia at 2007-7-12 10:41:28 > top of Java-index,Desktop,Core GUI APIs...
# 4
i still don't see how to call stop editing or cancel editing in tablelistener,please show it to me, these dukes point will be your's
suryanto_soa at 2007-7-12 10:41:28 > top of Java-index,Desktop,Core GUI APIs...
# 5

> i still don't see how to call stop editing or cancel editing in tablelistener,

You can't, because the TableModel has already been updated.

Did you read my first reply, I gave two possible solutions (because I didn't understand your question) with the idea that you would use the appropriate one!!!.

camickra at 2007-7-12 10:41:28 > top of Java-index,Desktop,Core GUI APIs...
# 6

if table listener couldn't call stop editing or cancelediting,

so please let me know how DefaultCellEditor or second link you give to me could update jlabel as amount information

note's

jlabel it's at different class file and my DefaultCellEditor it's at different class file to, i did this to make my class file reusebility.

i decide to increase duke to 8, please help me.

i will thank's to any one whose helpme, sorry for my english languang

suryanto_soa at 2007-7-12 10:41:28 > top of Java-index,Desktop,Core GUI APIs...
# 7
You need to use a combination of both solutions:a) the cell editor will edit valid valuesb) once the value is valid the TableModel will be updated and you can use a TableModelListener.
camickra at 2007-7-12 10:41:28 > top of Java-index,Desktop,Core GUI APIs...
# 8
thank's for that solution but however i already solve that problem by using AbstractAction at table so i could validate and update jlabel too.how ever i would say thank's for respond, and these dukes is belong to camickr.
suryanto_soa at 2007-7-12 10:41:28 > top of Java-index,Desktop,Core GUI APIs...
# 9
why i couldn't increase dukes reward to 8 for you.
suryanto_soa at 2007-7-12 10:41:28 > top of Java-index,Desktop,Core GUI APIs...