Java Applet Development Problem: Delay(int Ms)



Although I've used Windows 95 - XP extensively, this is my first Apple computer, an iBook G4, 1.2 Ghz, 256 MB RAM, 80 GB HDD, Mac OS 10.4.1. I am taking an introductory college Java programming course and have encountered a difficulty with Apple's Java's platform. One of my assignments was to write an applet which would read an integer (0 to 200) from the user and then paint a "thermometer" (a black Rectangle) with "mercury" (red Line2D.Doubles). The "mercury" was supposed to be animated, rising from the bottom of the thermometer to the integer the user entered. To implement this, I had the program paint the Line2D.Doubles at an interval of 50 milliseconds apart using the following code:

public void delay(int ms)
{ try
{ Thread.sleep(ms);

catch (Exception e)

On both my iBook and on Windows XP, it compiles without error messages and doesn't produce any error messages in the terminal and applet window. On XP, it runs as intended. However, on my iBook it waits the entire time allotted (e.g. user enters 150 ==> time = 150 * 50 milliseconds) before displaying anything, even the thermometer. On my iBook, I have used the appletviewer command, Mozilla 1.7.5, Internet Explorer 5.2, Mozilla Firefox 1.0.4, Camino 0.8, Opera 8.?, and the latest version of Safari to view it, all with the same problem. My instructor had no problems with XP and the same problem with an iBook G4. I have the Apple JDK environment 1.4.2_07 and installed J2SE 5.0 release 1. I can't have the source code posted publicly but could email it if it would help.

Any insight will be greatly appreciated. Thank-you!