Java Swing Look and Feel setLookAndFeel(String look)

Here you can find the source of setLookAndFeel(String look)

Description

Sets look and feel.

License

Open Source License

Parameter

Parameter Description
look the look

Exception

Parameter Description
IllegalArgumentException in case of the setting of look and feel is failed

Declaration

static void setLookAndFeel(String look) 

Method Source Code


//package com.java2s;
import javax.swing.UIManager;
import javax.swing.UnsupportedLookAndFeelException;

public class Main {
    /**// ww w .  j  a v  a 2 s  . com
     * Sets look and feel.
     *
     * @param look
     *            the look
     * @throws IllegalArgumentException
     *             in case of the setting of look and feel is failed
     */
    static void setLookAndFeel(String look) {
        try {
            UIManager.setLookAndFeel(look);
        } catch (ClassNotFoundException e) {
            throw new IllegalArgumentException("Class " + look + " is not found", e);
        } catch (InstantiationException e) {
            throw new IllegalArgumentException("Instantiation problem when setting look and feel", e);
        } catch (IllegalAccessException e) {
            throw new IllegalArgumentException("Security problem when setting look and feel", e);
        } catch (UnsupportedLookAndFeelException e) {
            throw new IllegalArgumentException("Unsupported look and feel is used", e);
        } catch (ClassCastException e) {
            throw new IllegalArgumentException("Class " + look + " is not a look and feel class", e);
        }
    }
}

Related

  1. setLookAndFeel(Component comp)
  2. setLookAndFeel(Component comp, LookAndFeel lf)
  3. setLookAndFeel(final Class lookAndFeel)
  4. setLookAndFeel(String laf)
  5. setLookAndFeel(String lafName)
  6. setLookAndFeel(String lookAndFeelClass)
  7. setLookAndFeelByName(final String lookAndFeel)
  8. setLookAndTheme(LookAndFeel laf, Object theme)
  9. setMetalLAF()