



Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!




synchronization issues in GUI code.There is only one event thread to avoid dealing withfunctions: event delivery, screen repainting, etc.The AWT maintains a separate thread for all GUI-related
non-CS types who wouldThe assumption is GUIs are programmed by graphic artists/
fi nd multi-threading too complex.
thread synchronization.multi-user requirements require advanced knowledge ofThe CS types would be assigned server-side work where
the event thread.(computation, I/O, etc.) must be done on a thread other than Any method that could take a long time to executeresponsive.painting to freeze and all GUI widgets to become non-prevents other events from being dispatched. This causes allAny long computation inside an event listener or paint method
Improve the threading behavior of a class:
Download the application class
(^) ThreadTest.java
(^) from the web site.
Observe how clicking either button freezes the animation.
Create a new thread class to process the call to
(^) button2Work()
.
Change
(^) button2()
(^) to create the new thread instead of calling
button2Work()
(^) directly from the event thread.
Have the new thread finish by kicking off a
(^) Runnable
(^) that restores
Button 2 to enabled status.