I'm about to design the largest Swing app I've ever written, and I'm studying the MVC design pattern.
Is it generally recommended to use standard event classes such as PropertyChangeEvent, or is it common to develop your own event class hierarchy?
Printable View
I'm about to design the largest Swing app I've ever written, and I'm studying the MVC design pattern.
Is it generally recommended to use standard event classes such as PropertyChangeEvent, or is it common to develop your own event class hierarchy?
I don't know the canonical answer to this, but I do know that there is a SwingPropertyChangeSupport built specifically for Swing apps that ensures that listeners are all notified on the EDT.
Hmm. If I understand this correctly, say I have a JPA Entity class modeling some data, and a Swing component displaying it. The Swing component would register a PropertyChangeListener on a SwingPropertyChangeSupport object, and the Entity class (or its enclosing logic) could fire events on that SwingPropertyChangeSupport to update the UI. Right?
If it seems like I'm going about this backwards, it's because my app is primarily not UI-driven. Most of the UI updates will be triggered by data changes, which themselves will be triggered by parsing a data stream from a game server.
The GUI could listen to the model for data changes and then extract the changes when they occur.