Java bug: getSystemLookAndFeelClassName() returns Metal, not GTK

Bug #133103 reported by David Nemeskey on 2007-08-17
This bug affects 1 person
Affects Status Importance Assigned to Milestone
openjdk-6 (Ubuntu)
sun-java6 (Ubuntu)

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, 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.

description: updated
description: updated
Matthias Klose (doko) wrote :

please recheck with gutsy, this appears to be fixed at least with the Gnome desktop

Changed in sun-java6:
status: New → Fix Released
David Nemeskey (nemeskeyd) wrote :

No, it's still the same (under KDE).

Richard Laager (rlaager) wrote :

This seems to work for me in Hardy in GNOME.

Here's a test program (save as, run "javac", then run "java HelloWorldApp"):

import javax.swing.UIManager;
class HelloWorldApp {
    public static void main(String[] args) {

David Nemeskey (nemeskeyd) wrote :

The bug is definitely still NOT fixed in Kubuntu Hardy. I believe that it's working in Gnome, but not in KDE.

The output of Richard's program is javax.swing.plaf.metal.MetalLookAndFeel under Kubuntu.

I also find kind of strange that the bug has been "fixed" on the same day as it was confirmed by Mr Nobody (see, no one is assigned to it). Can I reopen it, or should I open another one?

Hardy is EOL. Is this still an issue for you? Thank you for telling us!

Changed in openjdk-6 (Ubuntu):
status: New → Incomplete
David Nemeskey (nemeskeyd) wrote :

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);


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]
Installed: javax.swing.UIManager$LookAndFeelInfo[CDE/Motif]
Installed: javax.swing.UIManager$LookAndFeelInfo[GTK+]

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).

Ok, i mark this bug as confirmed. Maybe you could file this bug upstream in Java?

Changed in openjdk-6 (Ubuntu):
status: Incomplete → Confirmed
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers