Java Swing Look and Feel setLookAndFeel()

Here you can find the source of setLookAndFeel()

Description

set Look And Feel

License

MIT License

Declaration

public static void setLookAndFeel() 

Method Source Code

//package com.java2s;
/**/*from   ww w.j  a v a  2 s  .c o  m*/
 * Copyright (c) 2010 Simon Denier
 * Released under the MIT License (see LICENSE file)
 */

import javax.swing.UIManager;
import javax.swing.UnsupportedLookAndFeelException;

public class Main {
    public static int SPINNERHEIGHT = 25;

    public static void setLookAndFeel() {
        if (UIManager.getLookAndFeel().getID().equals("Aqua")) { //$NON-NLS-1$
            SPINNERHEIGHT = 20;
        } else { // try to use Nimbus unless on Mac Os
            try {
                UIManager.setLookAndFeel("com.sun.java.swing.plaf.nimbus.NimbusLookAndFeel"); //$NON-NLS-1$
            } catch (Exception e) {
                try {
                    UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
                } catch (ClassNotFoundException e1) {
                    e1.printStackTrace();
                } catch (InstantiationException e1) {
                    e1.printStackTrace();
                } catch (IllegalAccessException e1) {
                    e1.printStackTrace();
                } catch (UnsupportedLookAndFeelException e1) {
                    e1.printStackTrace();
                }
            }
        }
    }
}

Related

  1. setLookAndFeel()
  2. setLookAndFeel()
  3. setLookAndFeel()
  4. setLookandFeel()
  5. setLookAndFeel()
  6. setLookAndFeel()
  7. setLookAndFeel()
  8. setLookAndFeel(Component comp)
  9. setLookAndFeel(Component comp, LookAndFeel lf)