Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;

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

public class Main {
    /**
     * Set the look and feel of the application
     * 
     * @param lookAndFeel
     * @throws ClassNotFoundException
     * @throws InstantiationException
     * @throws IllegalAccessException
     * @throws UnsupportedLookAndFeelException
     */
    public static void setLookAndFeel(String lookAndFeel) throws ClassNotFoundException, InstantiationException,
            IllegalAccessException, UnsupportedLookAndFeelException {
        String className = null;
        for (LookAndFeelInfo l : UIManager.getInstalledLookAndFeels()) {
            if (l.getName().equalsIgnoreCase(lookAndFeel)) {
                className = l.getClassName();
                break;
            }
        }
        if (className != null)
            UIManager.setLookAndFeel(className);
    }
}