Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;
/*******************************************************************************
 * Copyright (c) 2009-2014 Black Rook Software
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the GNU Lesser Public License v2.1
 * which accompanies this distribution, and is available at
 * http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html
 ******************************************************************************/

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

public class Main {
    /**
     * Sets the system look and feel.
     * If this is not possible, this returns false. 
     * Otherwise, this sets the system look and feel and returns true.
     */
    public static boolean setSystemLAF() {
        try {
            UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
        } catch (ClassNotFoundException e) {
            return false;
        } catch (InstantiationException e) {
            return false;
        } catch (IllegalAccessException e) {
            return false;
        } catch (UnsupportedLookAndFeelException e) {
            return false;
        }
        return true;
    }
}