Lab 2
Lab 2
Today's task aims to show you how Java threads are used. You will
develop an applet that will display an analog clock like this.
Shared
Mem
Line Drawing
Calculations Thread. i.e.
Thread paint(...)
Calculation Thread
{
while(running)
calculate the lines positions
put the information in the shared memory
tell the applet to repaint
wait for one sec
}
Paint Method
{
Read Shared Memory
Draw Data
}
Minimum Requirements
1. Do not use any deprecated function in the source code.
2. Make sure that the thread terminates when the applet is closed.
3. Do not directly extend the Thread class.
4. The code should be able to accept a width parameter. Width
defines the width of the clock.
5. Do not do any kind of calculation inside the applet. Delegate
all calculations to one or more threads.