I have a single-threaded program (essentially a character generator) that I'm writing. I have a model class which houses pretty much all of the character's information. I want this to be represented in the GUI. I want the GUI to update every component anytime a value is changed for any field.
I currently have the GUI class set up as an Observer to the Character class, so anytime updates to the Character are performed, the GUI is updated. But, this is only part of the functionality I want, as I want each GUI field updated each time a GUI field is changed.
Would it be bad form to write a single changelistener class that updates every field and add it to every JComponent in the GUI class. This seems kind of hacky/potentially buggy to me. Any suggestions for a better design pattern?
Currently I have around 50 JComponents that display data and will be adding at least as many as development goes on. So, I kind of wanted to keep from screwing myself in the long run. Thanks for insight in advance!
Aucun commentaire:
Enregistrer un commentaire