icewm is not my favourite window manager

Update: I’m a fucking idiot. Turns out I was calling JFrame.setDefaultLookAndFeelDecorated(true); when I should have been calling JDialog.setDefaultLookAndFeelDecorated(true);. All fixed now.

There is a complex interaction between X Windows window managers and Java’s look and feel manager. And it is currently driving me crazy.

Our project choose the “Ice”, aka “icewm” as our window manager. We choose it because

  1. It is very lightweight
  2. It was relatively easy to strip out all the stuff we don’t want
  3. It had translation files so it would automatically display in all the languages we support

On the downside, it also looks very “Windows 3.1″ish, and it’s stupid as hell. The thing that’s currently driving me nuts is that when you use JOptionPane.show.*Dialog to display simple dialogs, Ice insists on putting close and iconify icons on the dialog. Two problems with that

  • The icons overlap the title meaning you can’t read the last word in the title.
  • If you’re dumb enough to actually iconify the dialog, it’s damn near impossible to find it again, and since it is modal, you’re basically stuck until you can figure out where it went.

So here I am trying to figure out how to make JOptionPane tell Ice to stop doing this. JOptionPane.setDefaultLookAndFeelDecorated(true) doesn’t seem to do anything. I discovered in my own dialogs that use my own subclass of JDialog, I can achieve something a little less horrible by calling setUndecorated(true); and getRootPane().setWindowDecorationStyle(JRootPane.FRAME); which gets rid of Ice’s title bar and replaces it with a Java-style title bar that only has a close icon on it.

I downloaded the JDK source code to see if there was anyway I could do something similar in JOptionPane. There are a couple of methods in JOptionPane that look promising, but of course Sun made them private so I can’t override them. I could replace JOptionPane entirely, but that’s probably a gross violation of the license that I downloaded the JDK source under.

I’m hoping that next release I can convince the powers that be to switch to XFCE or something else that looks a little more modern and perhaps will listen to the window manager hints from Java.

Sigh.