Java Swing Look and Feel setLookandFeel()

Here you can find the source of setLookandFeel()

Description

set Lookand Feel

License

Open Source License

Declaration

public static void setLookandFeel() 

Method Source Code

//package com.java2s;
/**/*from  www .  ja  va 2 s . com*/
 * @author David Garratt
 * 
 * Project Name : Commander4j
 * 
 * Filename     : JUtility.java
 * 
 * Package Name : com.commander4j.util
 * 
 * License      : GNU General Public License
 * 
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as
 * published by the Free Software Foundation, either version 3 of the 
 * License, or (at your option) any later version.
 * 
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 * 
 * You should have received a copy of the GNU General Public 
 * License along with this program.  If not, see
 * http://www.commander4j.com/website/license.html.
 * 
 */

import javax.swing.UIManager;
import javax.swing.plaf.metal.DefaultMetalTheme;
import javax.swing.plaf.metal.MetalLookAndFeel;
import javax.swing.plaf.metal.OceanTheme;

public class Main {
    public static void setLookandFeel() {

        try {
            SetLookAndFeel("Metal", "Ocean");
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

    public static void SetLookAndFeel(String LOOKANDFEEL, String THEME) {
        try {
            if (LOOKANDFEEL.equals("Metal")) {
                if (THEME.equals("DefaultMetal"))
                    MetalLookAndFeel.setCurrentTheme(new DefaultMetalTheme());
                else if (THEME.equals("Ocean"))
                    MetalLookAndFeel.setCurrentTheme(new OceanTheme());

                UIManager.setLookAndFeel(new MetalLookAndFeel());

            }
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}

Related

  1. setLookAndFeel()
  2. setLookAndFeel()
  3. setLookAndFeel()
  4. setLookAndFeel()
  5. setLookAndFeel()
  6. setLookAndFeel()
  7. setLookAndFeel()
  8. setLookAndFeel()
  9. setLookAndFeel()