Search code examples
javaswinguser-interfacelook-and-feelnimbus

Suggestions on using a Look and Feel for my Java project


I want to use a Look and Feel for my Java GUI project (in Swing) in which the windows container's frame color is dark and the color of the body of the container is white.

As an example, you can see the picture of the browser: the frame is black while the body is white. I want something like that in my Java GUI project. Preferably a Nimbus L&F, so any suggestions?

enter image description here


Solution

  • Try this one for Nimbus look and feel.

    SwingUtilities.invokeLater(new Runnable() {
    
        @Override
        public void run() {
            try {
                for (LookAndFeelInfo info : UIManager.getInstalledLookAndFeels()) {
                    if ("Nimbus".equals(info.getName())) {
                        UIManager.setLookAndFeel(info.getClassName());
                        break;
                    }
                }
            } catch (Exception e) {
                e.printStackTrace();
                // If Nimbus is not available, you can set the GUI to 
                // another look and feel.
            }
        }
    });
    

    For more info have a look at below links: