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.
Asked
Active
Viewed 1.0k times
3 Answers
51
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.

Myer
- 3,670
- 2
- 39
- 51
-
1This is really the only viable option, as the AWT_TOOLKIT override no longer works on modern versions of Java, yet, this hack works on modern javas. You would not believe how many months I spent trying to solve this problem before I realised my window manager was causing it. – Kent Fredric Nov 01 '12 at 12:41
-
1It works like a charm. Thanks! And we can install `wmname` with `sudo apt-get install suckless-tools`. – tobe Feb 11 '15 at 06:59
-
Works also for me Netbeans 8 and Awesome3 – Jens Peters Jun 10 '15 at 21:01
9
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

Daniel Fanjul
- 3,493
- 3
- 26
- 29
-
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 Apr 09 '09 at 21:58
-
1java-6-openjdk package only has i386/xawt/libmawt.so and i386/headless/libmawt.so. Sun JDK also includes i386/motif21/libmawt.so – Daniel Fanjul Apr 13 '09 at 08:50
-
1This 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. – Myer Oct 10 '10 at 02:33