Nimbus Look and Feel is not applied correctly all the time

"bbergeson" <[email protected]>
Newsgroups gmane.comp.java.netbeans.modules.openide.devel
Message-ID <[email protected]>
I did see that bug and I do have some actions that are performed in other modules, but those modules depend on this module, and I even made those modules to load eagerly, so this module should get loaded first, and I did wrap the actions in a SwingUtilities.invokeLater thread, but that didn't fix the problem and it caused the items presented in those actions, which is the main Logo for the company and another a label, to be delayed in showing up so it doesn't look good to the user.

In the installer class I am doing the following to set the look and feel.  I have some extra code since I was trying to allow the user to be able to pick a normal Nimbus L&F or a Dark Nimbus L&F, but I have not been able to get the switching to work right when switching from the Dark Nimbus L&F back to the normal L&F, but that is a different topic.


Code:

public void restored() {

    Preferences prefs = NbPreferences.root().node("laf");

    if (useDarkTheme)  {  // I have this set to false at this point because there are some issues when using the Dark theme.
        prefs.put("laf", "org.netbeans.swing.laf.dark.DarkNimbusLookAndFeel");
        try { 
            UIManager.setLookAndFeel("org.netbeans.swing.laf.dark.DarkNimbusLookAndFeel");
        } catch (ClassNotFoundException | InstantiationException | IllegalAccessException | UnsupportedLookAndFeelException ex) {
            Exceptions.printStackTrace(ex);
        }

    } else {        
        prefs.put("laf", "javax.swing.plaf.nimbus.NimbusLookAndFeel");
        try { 
            UIManager.setLookAndFeel("javax.swing.plaf.nimbus.NimbusLookAndFeel");
        } catch (ClassNotFoundException | InstantiationException | IllegalAccessException | UnsupportedLookAndFeelException ex) {
            Exceptions.printStackTrace(ex);
        }
}
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.