Meaningless Drivel is fun!*
The moose likes Developer Certification (SCJD/OCMJD) and the fly likes Is a table listener needed to update a JTable? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Developer Certification (SCJD/OCMJD)
Bookmark "Is a table listener needed to update a JTable?" Watch "Is a table listener needed to update a JTable?" New topic
Author

Is a table listener needed to update a JTable?

Sean Gildea
Ranch Hand

Joined: Jul 01, 2004
Posts: 81
Hi Ranchers,

I've been having a problem refreshing data in my JTable, and everyone says to use

fireTableDataChanged();

However, the API doc for this method says

void fireTableDataChanged()
Notifies all listeners that all cell values in the table's rows may have changed.

So heres my question: Do I need to register/create a table listener? And if so, how do I do it?

Code example would be perfect!

Thanks!


SCJD, SCBCD, SCJP
Clivant Yeo
Ranch Hand

Joined: May 22, 2004
Posts: 124
Hi Sean,

Two TableListeners are added implicitly to the JTable when you created it, as such there is no need to add your own Listeners, unless you want other custom actions to be performed when the fireTableDataXXX method is invoked.

Regards,
Clivant


Clivant Yeo
My Personal Website
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Is a table listener needed to update a JTable?