There are numerous versions of Java (hmmm, there must be problems). This page recounts some of my experiences.
Obvious solution, try Java 2 v1.2.2 - same crap.
After several days of spinning our wheels and getting nowhere, we gave up and declared Java to be brain dead.
Well, 2 months after the project was due, we tried Java 2 v1.3.1_01. Well, that fixed the problem, and several others. It turned out to be a Java design problem after all. (Apparently, 1.3.1 fixes several paint method bugs.) I do expect that the examples given in a book will work with the compiler supplied with the book.
The leason here is simple
If the code looks good, but it still doesn't work - don't assume that it is your fault.Corallary
Don't assume that your code will run on any machine except yours.Conclusion
Java is a waste of time.