Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

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

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

public class Main {
    /**
     * Sets look and feel to Nimbus.
     * 
     * @return
     */
    public static boolean setNimbusLF() {
        try {
            for (LookAndFeelInfo laf : UIManager.getInstalledLookAndFeels()) {
                if ("Nimbus".equals(laf.getName())) {
                    UIManager.setLookAndFeel(laf.getClassName());
                    break;
                }
            }
        } catch (Exception e) {
            // If Nimbus is not available, you can set the GUI to another look and feel.
            return false;
        }
        return true;
    }
}