The end of the Gray Screen of Boredom?

One of the most long-standing bugs in Java Swing is the infamous "Gray Rect" (hereafter known as the "Gray Screen of Boredom" [GSoB]). In fact the GSoB is probably THE main cause of the widespread perception that Swing is slow and unresponsive (that and lazy programmers who dump all their processing code in the AWT Event Dispatch Thread).

The GSoB happens when you switch to a different window then switch back to your Swing application. There may be a pause of several seconds or more before the window repaints, during which all that's visible is an ugly gray rectangle. In extreme (though not uncommon) cases I've known people to sit staring at this gray rectangle for nearly 2 minutes - and not on particularly overstretched PCs either.

Nearly a decade after the GSoB annoyed its first user, the Swing gurus at Sun have finally fixed the problem! (I shouldn't be bitter, this really is a major step forward for Swing). We're unlikely to see this fix in a point-release for Java 5 – but it's already possible to download a very early development build of the next big version of Java (code-name Mustang, also known variously as Java 1.6, Java 6 and J2SE 6.0).

About the Author

Matt Stephens is a senior architect, programmer and project leader based in Central London. He co-wrote Agile Development with ICONIX Process, Extreme Programming Refactored, and Use Case Driven Object Modeling with UML - Theory and Practice.