This problem usually only happens in some exotic non-reparenting window manager such as awesome, dwm, subtle, and probably others. I use only awesome so this is my experience in awesome window manager. Even when since release 3.5.x, awesome has become a reparenting window manager, the weird behaviour above still exists (the menu problem). Uncommit source code is not an option for me.
If you experience this, there are two things that can be done:
- Change JDK from Oracle JDK to OpenJDK. I tested with OpenJDK 2.4.2 (IcedTea) and Awesome 3.5.2. This works very well without any extra steps.
- Use wmname and execute "wmname LG3D" from shell before running Java GUI application. This option is needed if we use Oracle JDK. I tested this with Oracle JDK 1.7.0_u45.