Concurrent Programming with Java
Lab Manual, Version 1.0, F. Astha Ekadiyanto,
2002.
Lab 3: Building Applets - Graphical representation
We want to represent an Msc graphically by drawing all the registered Rbs (which is stored in the rbss[] array) into the Graphics context. Since we have defined the draw(Graphics) method of Rbs, we can just call them for each element stored in the rbss[] array.
for (int i=0; i<numOfRbs; i++)
{ rbss[i].draw(g); }
The complete implementation in Java is shown below.
import java.util.*; // . . . all other code of the original Msc Class public void draw(Graphics g) { |