Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / GUI / October 2005

Tip: Looking for answers? Try searching our database.

JTable: detect when any cell's value changes

Thread view: 
Ian McCall - 21 Oct 2005 01:24 GMT
Hi.

I'd like to detect when the value of a cell changes, hopefully
-without- adding listeners to each and every cell. I don't care what
the value is or which cell has changed, just the fact that a change
took place.

Any clues? I tried adding a TableModelListener but that didn't notify
me about the data changes.

Cheers,
Ian
Vova Reznik - 21 Oct 2005 15:21 GMT
> Hi.
>
[quoted text clipped - 7 lines]
> Cheers,
> Ian

Changes go to TableModel setValueAt(Object value, int rowIndex, int
columnIndex)

If you have our own model then it will be very simple for you.
If not - you may need to have it.
See example in DefaultTableModel::setValueAt(Object, int, int)
Ian McCall - 21 Oct 2005 15:48 GMT
>> Any clues? I tried adding a TableModelListener but that didn't notify
>> me about the data changes.
[quoted text clipped - 4 lines]
> Changes go to TableModel setValueAt(Object value, int rowIndex, int
> columnIndex)

Thanks - problem sorted. setValueAt() had been overridden in the
AbstractTableModel which was fine, but unbeknown to me had -also- been
overridden in the particular instance of JTable. The JTable version
wasn't firing any events, so the model was never notified properly.
Take out the overridden JTable method and things propagate as expected
to the TableModel.

Cheers,
Ian


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.