I don't know if this is possible. I have a data structure that is displayed in various tabbed panels in various forms(JList/JCheckList etc.). Some of these panels are able to manipulate the data structure. Is there a way to attach some sort of ActionListener to data structure so whatever class has a copy of it will know that a change has occured and recreate the display?

Please advise.

You should know when the data is going to change. Encapsulation isn't the best thing in the world, but it does let you notice changes in things. Your "data structure" should have methods that allow users to write to it, when these methods occur you can invoke an action in something "listening" to it. The observer class doesn't really do (or observe) anything!

If your data is modified outside the application you have to poll it for changes... or add some kind of OS hook that notifies your app; better still, only let your data structure be changed using a self-agreed protocol that involves notifying your "observing" program.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.