Problem 3: Double Rotator

Demonstrates concurrent execution of multiple threads.

Unable to load applet

The applet is only partially implemented, i.e., it does not use threads.

 

Exercise:

Modify the class RotatorPanel in a way that when the button "Run" is pressed, the corresponding arc starts to rotate, and when the button "Pause" is pressed, the corresponding arc stops rotating.

Hint: The modified RotatorPanel class should implement the Java interface Runnable. The solution should use the Thread methods wait and notifyAll which implies that you have to consider an appropriate synchronization. The rotation of the corresponding arcs is achieved by calling method "rotate()" of class ArcPanel in the method "run()" to be implemented.

Sources:

DoubleRotator.java, RotatorPanel.java, ArcPanel.java

Result:

The result may look like this.