views:

1716

answers:

3

The swing-UI of Java-programs doesn't work perfectly together with the awesome-wm. awesome is a window-manager for UNIX, that automatically resizes program-windows, and the Swing-UI doesn't recognize these resizes correctly. I don't care if awesome or Java is guilty, what I wanna know if I can change my Java-programs in a way, that they will work with awesome. So that users of my programs get the correct experience, even when they use exotic window-managers.

+2  A: 

You might find that this is a similar problem to that experienced with using Compiz and Java (on Ubuntu at least), but I am guessing.

The fix for this (taken from here) is to add the following environment variable to your program:

AWT_TOOLKIT="MToolkit"
Rich
+3  A: 

From the man page of awesome:

BUGS
   Of course there´s no bug in awesome. But there may be unexpected behaviours.

   Java applications which use the XToolkit/XAWT backend may draw grey windows only. The XToolkit/XAWT backend breaks ICCCM-compliance
   in recent JDK 1.5 and early JDK 1.6 versions, because it assumes a reparenting window manager. As a workaround you can use JDK 1.4
   (which doesn´t contain the XToolkit/XAWT backend) or you can set the following environment variable (to use the older Motif backend
   instead): AWT_TOOLKIT=MToolkit
Banengusk
This brings up the following exception: Exception in thread "main" java.lang.UnsatisfiedLinkError: Can't load library: /usr/lib/jvm/java-6-openjdk/jre/lib/i386/motif21/libmawt.so
Mnementh
java-6-openjdk package only has i386/xawt/libmawt.so and i386/headless/libmawt.so. Sun JDK also includes i386/motif21/libmawt.so
Banengusk
Thanks for this hint. With the SUN-JDK it works.
Mnementh
This solution isn't perfect. If you use Netbeans IDE, setting AWT_TOOLKIT=MToolkit will result in locking out the keyboard b/c of an old swing bug: http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6506617. MToolkit may not give you any problems, just remember - if your keyboard starts to loose focus, you may need to use AWT_TOOLKIT=XToolkit.
Peter Nore
+4  A: 

Easiest workaround - get wmname from suckless and use it to set the name of the window manager to LG3D:

wmname LG3D

98% of the time this will fix the issue.

Peter Nore