<Swing Dev> Nimbus no longer part of JRE6?

Walter Laan W.Laan at costengineering.eu
Thu Jun 17 13:54:01 UTC 2010


> I've just installed JRE6u20 (sun's proprietary builds) and as far as I
> can see nimbus is no longer included in that distribution?
> Am I just wrong, or has it really been omitted?

It's still under com.sun.java.plaf.nimbus.*

import java.awt.EventQueue;

import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.UIManager;
import javax.swing.UIManager.LookAndFeelInfo;

public class TestNimbus {
    public static void main(String[] args) {
        EventQueue.invokeLater(new Runnable() {
            public void run() {
                String nimbus = "No Nimbus";
                for (LookAndFeelInfo info : UIManager.getInstalledLookAndFeels()) {
                    if ("nimbus".equalsIgnoreCase(info.getName())) {
                        try {
                            nimbus = info.getClassName();
                            UIManager.setLookAndFeel(nimbus);
                        }
                        catch (Exception e) {
                            e.printStackTrace();
                        }
                        break;
                    }
                }

                JFrame frame = new JFrame("Test");
                frame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
                frame.getContentPane().add(new JLabel(
                                System.getProperty("java.version") + ": " + nimbus));
                frame.pack();
                frame.setLocationRelativeTo(null);
                frame.setVisible(true);
            }
        });
    }
}



More information about the swing-dev mailing list