Our CyberCardiologist applet uses fairly standard Java threading. One difference is that, rather than the CyberCardiologist applet subclass, the Thread, and the Runnable object all being separate, in our implementation, the CyberCardiologist applet is itself the Runnable object (that is, it has its own run() method), and contains the thread that runs it as one of its own variables, as shown in the diagram below. This is the more object-oriented way of doing this--the browser can then simply send a signal to CyberCardiologist asking it to run itself. CyberCardiologist then has contained within itself everything necessary to entertain that request.
Also, as illustrated, the CyberCardiologist applet contains the variables which describe the state of the simulated heart. In addition to init(), start() and stop(), we have also overridden other default Applet class methods: update(), mouseDown() and mouseUp(). We have redefined them to do things appropriate for displaying and interacting with our CyberCardiologist simulation using the mouse .

The heart (so to speak) of our applet is contained in the run() method. In this method is a loop which repeatedly updates the heart variables, thus modeling the changes and behavior of the heart as a function of time. Every so often, the run() method requests that the window containing a colorplot of the heart be updated. To do this, run() calls the default repaint() method, which in turn sends a message to the supervisor thread, requesting that the window be updated. When the supervisor thread feels like it, it runs our update() method residing inside CyberCardiologist. We defined update() to display our heart variables in the form of a colorplot. This colorplot is the orange, blue and purple animation of action potential propagation you see on your browser.
Another feature of CyberCardiologist is its ability to generate a stimulus in a region defined by the user using the mouse. Anytime the user pushes the mouse button down, an event is generated, which the supervisor thread passes as a message to the CyberCardiologist applet's mouseDown() method. Our version of mouseDown() simply notes the position of the mouse and returns. When the mouse button is released, another event is generated, which the supervisor thread passes to the mouseUp() method in CyberCardiologist. We have redefined mouseUp() to modify the heart variables in a manner consistent with the application of a stimulus delivered to the heart in the region defined by the mouseDown coordinates previously recorded and the present position of the mouse. The heart algorithm inside the run() method will then take these new values of the heart variables into account and react to the newly defined stimulus.