Search code examples
javanetbeans-7nimbus

nimbus as defalut


I'm using java 7 update 17 and netBeans IDE 7.3 I would to set the nimbus as default for every GUI project but oracle website instruction not working .

how to set nimbus at default for every project ?

I write my code manually without use palette , or drag and drop .

and this instruction does not work http://docs.oracle.com/javase/tutorial/uiswing/lookandfeel/nimbus.html


Solution

  • The following called at the start of the main

    try {
        for (UIManager.LookAndFeelInfo info : UIManager.getInstalledLookAndFeels()) {
            System.out.println("LAF: " + info.getName());
            if ("Nimbus".equals(info.getName())) {
                UIManager.setLookAndFeel(info.getClassName());
                //break;
            }
        }
    } catch (ClassNotFoundException | InstantiationException
        | IllegalAccessException | javax.swing.UnsupportedLookAndFeelException ex) {
        Logger.getLogger(MainFrame.class.getName()).log(Level.SEVERE, null, ex);
    }
    

    gave

    LAF: Metal
    LAF: Nimbus
    LAF: CDE/Motif
    LAF: Windows
    LAF: Windows Classic
    

    It's copied from the code of the main of a generated JFrame form in NetBeans.

    After that

        EventQueue.invokeLater(new Runnable() {
            @Override
            public void run() {
                mainFrame.setVisible(true);
            }
        });
    

    And I guess there it must be going awry.

    Maybe you have some command line options, system java settings, selecting a LAF already and "extending" Nimbus (Plastic or so)?