This is a Java Swing bug when Linux desktop 3D effect is open, such as beryl/
Xgl/Compiz effect. See Sun's bug report:
Bug ID: 6429775 Xgl/Compiz/Java 1.5/Swing problem
To solve this problem, a temporary solution is to add AWT_TOOLKIT=MToolkit in your system's environment, or try to close the 3d effect. Take Ubuntu Linux as an example:
sudo gedit
/etc/environment
and past the following line in it: AWT_TOOLKIT=MToolkit
and then restart the X window system.
A better solution is to update to the latest java version jdk6u2 or higher, which declares to solve this bug.