Java Reference
In-Depth Information
Listing 9.2. Executor Built Atop SwingUtilities .
Listing 9.3. Simple Event Listener.
A slightly more complicated version of this same scenario, illustrated in Figure 9.2 , involves
the use of a formal data model such as a TableModel or TreeModel . Swing splits most
visual components into two objects, a model and a view. The data to be displayed resides
in the model and the rules governing how it is displayed reside in the view. The model
objects can fire events indicating that the model data has changed, and views subscribe to
these events. When the view receives an event indicating the model data may have changed,
it queries the model for the new data and updates the display. So in a button listener that
Search WWH ::




Custom Search