Java Swing Look and Feel isNativeMacLookAndFeel()

Here you can find the source of isNativeMacLookAndFeel()

Description

is Native Mac Look And Feel

License

Open Source License

Declaration

public static boolean isNativeMacLookAndFeel() 

Method Source Code

//package com.java2s;
/*/*from w  w w  . j a  v a  2 s  . c  o  m*/
 * UIUtils.java  2/6/13 1:04 PM
 *
 * Copyright (C) 2012-2013 Nick Ma
 *
 * 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 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.
 */

import javax.swing.UIManager;

public class Main {
    /**
     * True if checked for mac yet.
     */
    private static boolean checkedMac;
    /**
     * True if running on Mac.
     */
    private static boolean isMac;

    public static boolean isNativeMacLookAndFeel() {

        if (!isMac()) {

            return false;
        }

        String laf = UIManager.getLookAndFeel().getClass().getName();
        return (laf.equals(UIManager.getSystemLookAndFeelClassName()));
    }

    /**
     * Returns true if running on Mac.
     */
    public static boolean isMac() {
        if (!checkedMac) {
            String osName = System.getProperty("os.name");
            if (osName != null && osName.indexOf("Mac") != -1) {
                isMac = true;
            }
            checkedMac = true;
        }
        return isMac;
    }
}

Related

  1. isMacLookAndFeel()
  2. isMacOSXLookAndFeel()
  3. isMetalLookAndFeel()
  4. isMotif()
  5. isMotiflLnF()
  6. isNimbus()
  7. isNimbus()
  8. isNimbus()
  9. isNimbusGTKTheme()