Java Swing Look and Feel isMacOSXLookAndFeel()

Here you can find the source of isMacOSXLookAndFeel()

Description

Return true if the current look and feel is the MacOSX look and feel.

License

Open Source License

Return

true if the current look and feel is the MacOSX look and feel

Declaration

public static boolean isMacOSXLookAndFeel() 

Method Source Code

//package com.java2s;
/*/* w ww.  ja  v  a2s. c om*/
    
dsh-identify  Lightweight components for identifiable beans.
Copyright (c) 2003-2019 held jointly by the individual authors.
    
This library is free software; you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as published
by the Free Software Foundation; either version 3 of the License, or (at
your option) any later version.
    
This library is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; with out even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
License for more details.
    
You should have received a copy of the GNU Lesser General Public License
along with this library;  if not, write to the Free Software Foundation,
Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307  USA.
    
> http://www.fsf.org/licensing/licenses/lgpl.html
> http://www.opensource.org/licenses/lgpl-license.php
    
*/

import javax.swing.LookAndFeel;
import javax.swing.UIManager;

public class Main {
    /** JDK <= 1.5 MacOSX look and feel class name. */
    private static final String JDK15_MAC_OSX_LOOK_AND_FEEL_CLASS_NAME = "apple.laf.AquaLookAndFeel";
    /** JDK >= 1.6 MacOSX look and feel class name. */
    private static final String JDK16_MAC_OSX_LOOK_AND_FEEL_CLASS_NAME = "com.apple.laf.AquaLookAndFeel";

    /**
     * Return true if the current look and feel is the MacOSX look and feel.
     *
     * @see #JDK15_MAC_OSX_LOOK_AND_FEEL_CLASS_NAME
     * @see #JDK16_MAC_OSX_LOOK_AND_FEEL_CLASS_NAME
     * @return true if the current look and feel is the MacOSX look and feel
     */
    public static boolean isMacOSXLookAndFeel() {
        LookAndFeel lookAndFeel = UIManager.getLookAndFeel();
        if (lookAndFeel == null) {
            return false;
        }
        return JDK15_MAC_OSX_LOOK_AND_FEEL_CLASS_NAME.equals(lookAndFeel.getClass().getName())
                || JDK16_MAC_OSX_LOOK_AND_FEEL_CLASS_NAME.equals(lookAndFeel.getClass().getName());
    }
}

Related

  1. isLookAndFeel(String name)
  2. isLookAndFeelNative()
  3. isMacAquaLookAndFeel()
  4. isMacLookAndFeel()
  5. isMacLookAndFeel()
  6. isMetalLookAndFeel()
  7. isMotif()
  8. isMotiflLnF()
  9. isNativeMacLookAndFeel()