Please enable JavaScript.
Coggle requires JavaScript to display documents.
9.2 Short-running GUI Tasks - Coggle Diagram
9.2 Short-running GUI Tasks
Event Origin and Flow
Events start in the event thread
Events are handled by application-provided listeners
Listeners affect presentation objects (e.g., UI changes)
Short-running Task Handling
Entire action can stay in the event thread
Safe when:
Task is quick
Only accesses GUI/thread-safe/thread-confined objects
Threading concerns minimal in this case
Confinement to Event Thread
Natural to confine presentation logic to the EDT
As long as:
Work is short-lived
Objects accessed are confined or thread-safe
Swing Component Design
Swing splits components into:
Model: holds the data
View: governs display logic
Model-View Interaction
Model fires events when data changes
View subscribes to these events
When notified:
View queries model
View updates display