Java Swing Look and Feel setBestLookAndFeelAvailable()

Here you can find the source of setBestLookAndFeelAvailable()

Description

set Best Look And Feel Available

License

Open Source License

Declaration

public static void setBestLookAndFeelAvailable() 

Method Source Code

//package com.java2s;
/* Copyright 2009-2014 Edouard Garnier de Labareyre
 *
 * This file is part of B@ggle./*from  www .  ja  v a2 s.  co  m*/
 *
 * B@ggle 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.
 *
 * B@ggle 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 B@ggle.  If not, see <http://www.gnu.org/licenses/>.
 */

import javax.swing.UIManager;

public class Main {
    public static void setBestLookAndFeelAvailable() {
        String system_lf = UIManager.getSystemLookAndFeelClassName().toLowerCase();
        if (system_lf.contains("metal")) {
            try {
                UIManager.setLookAndFeel("com.sun.java.swing.plaf.nimbus.NimbusLookAndFeel");
            } catch (Exception e) {
            }
        } else {
            try {
                UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
            } catch (Exception e) {
            }
        }
    }
}

Related

  1. matchLnf(LookAndFeel lookAndFeel, UIManager.LookAndFeelInfo lookAndFeelInfo)
  2. metalLookAndFeel()
  3. nativeLook()
  4. printInstalledLookAndFeel()
  5. printInstalledPLAFs()
  6. setCoolLookAndFeel()
  7. setDefaultLookAndFeel()
  8. setDefaultLookandfeel()
  9. setJavaLookAndFeel()