← Back to team overview

openjdk team mailing list archive

[Bug 133103] Re: Java bug: getSystemLookAndFeelClassName() returns Metal, not GTK

 

It is still an issue in 12.04. The following program:

import javax.swing.UIManager;

public class Test {
    public static void main(String[] args) {
        System.out.println("System: " + UIManager.getSystemLookAndFeelClassName());
        System.out.println("CrossPlatform: " + UIManager.getCrossPlatformLookAndFeelClassName());
        for (UIManager.LookAndFeelInfo laf : UIManager.getInstalledLookAndFeels())
            System.out.println("Installed: " + laf);
    }
}

prints

System: javax.swing.plaf.metal.MetalLookAndFeel
CrossPlatform: javax.swing.plaf.metal.MetalLookAndFeel
Installed: javax.swing.UIManager$LookAndFeelInfo[Metal javax.swing.plaf.metal.MetalLookAndFeel]
Installed: javax.swing.UIManager$LookAndFeelInfo[Nimbus com.sun.java.swing.plaf.nimbus.NimbusLookAndFeel]
Installed: javax.swing.UIManager$LookAndFeelInfo[CDE/Motif com.sun.java.swing.plaf.motif.MotifLookAndFeel]
Installed: javax.swing.UIManager$LookAndFeelInfo[GTK+ com.sun.java.swing.plaf.gtk.GTKLookAndFeel]

As you see, the system LaF is still Metal. Under Gnome, it is GTK.

I am aware that for KDE, a QtLookAndFeel would be the best match, but
since no such thing exist, UIManager.getSystemLookAndFeelClassName()
should default to GTK as the closest match (especially since by default,
KDE sets the GTK style to QtCurve and the fonts to the ones used by KDE
applications).

-- 
You received this bug notification because you are a member of OpenJDK,
which is subscribed to openjdk-6 in Ubuntu.
https://bugs.launchpad.net/bugs/133103

Title:
  Java bug: getSystemLookAndFeelClassName() returns Metal, not GTK

Status in “openjdk-6” package in Ubuntu:
  Incomplete
Status in “sun-java6” package in Ubuntu:
  Fix Released

Bug description:
  Binary package hint: sun-java6-jdk

  When using the UIManager.getSystemLookAndFeelClassName() method, it
  returns javax.swing.plaf.metal.MetalLookAndFeel (the cross-platform
  one), and not com.sun.java.swing.plaf.gtk.GTKLookAndFeel, as expected.
  If the UIManager.setLookAndFeel() method is called with the latter,
  the L&F will be set to GTK, so it is definitely there; the system just
  fails to recognize it as the default L&F.

  This error is reproducible with sun-java5-jdk as well; I have not
  tried the -jre packages or gcj. Both the <jdk root>/bin/java and
  <jdk_root>/jre/bin/java works alike.

  I am using Kubuntu 7.04.

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/openjdk-6/+bug/133103/+subscriptions