Archive for the ‘Note to self’ Category

Changing java swing look and feel

Wednesday, February 17th, 2010

To run, say, the wmqttSample java application using the gtk look and feel for swing:

  • java -Dswing.defaultlaf=com.sun.java.swing.plaf.gtk.GTKLookAndFeel -jar wmqttSample.jar

Thanks to Andy Piper.

Also, from http://seysayux.wordpress.com/2009/01/11/make-java-use-the-gtk-look-feel-on-linux/ :

First, you’ll have to locate the directory your JVM is residing in. Unless your distribution did some real weird things, it’s usually either /usr/lib/jvm/<version> or /usr/java/[<version>] . Wherever it might be located, i’ll use /usr/lib/jvm/jre-1.6.0_10/ for the examples.

Locate the file named /usr/lib/jvm/jre-1.6.0_10/lib/swing.properties. If it doesn’t exist, create it.

Put the following inside the file:

swing.defaultlaf=com.sun.java.swing.plaf.gtk.GTKLookAndFeel