Java Swing Look and Feel setNimbusLookAndFeel()

Here you can find the source of setNimbusLookAndFeel()

Description

Tries to set the NimbusLookAndFeel

License

Open Source License

Return

if the NimbusLookAndFeel could bet set

Declaration

public static boolean setNimbusLookAndFeel() 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

import javax.swing.*;

public class Main {
    /**/*w  w  w. j  av  a  2s.  c  o m*/
     * Tries to set the NimbusLookAndFeel
     * 
     * @return if the NimbusLookAndFeel could bet set
     */
    public static boolean setNimbusLookAndFeel() {
        boolean isNumbusSet = true;
        try { // Nimbus Loyout
            UIManager.setLookAndFeel("com.sun.java.swing.plaf.nimbus.NimbusLookAndFeel");
        } catch (ClassNotFoundException e) {
            isNumbusSet = false;
        } catch (InstantiationException e) {
            isNumbusSet = false;
        } catch (IllegalAccessException e) {
            isNumbusSet = false;
        } catch (UnsupportedLookAndFeelException e) {
            isNumbusSet = false;
        }
        return isNumbusSet;

        /*
         * try {//alternative way for (LookAndFeelInfo info :
         * UIManager.getInstalledLookAndFeels()) { if ("Nimbus".equals(info.getName())) {
         * UIManager.setLookAndFeel(info.getClassName()); break; } } } catch
         * (UnsupportedLookAndFeelException e) { } catch (ClassNotFoundException e) { } catch
         * (InstantiationException e) { } catch (IllegalAccessException e) { }
         */
    }
}

Related

  1. setMotifLookAndFeel()
  2. setNativeLookAndFeel()
  3. setNativeLookAndFeel()
  4. setNiceSwingLookAndFeel()
  5. setNimbusLookAndFeel()
  6. setSOMToolboxLookAndFeel()
  7. setSystemLAF()
  8. setSystemLAF()
  9. setSystemLaF()