Java Swing Look and Feel isWindowsClassicLookAndFeel()

Here you can find the source of isWindowsClassicLookAndFeel()

Description

Determines if current L&F is Windows Classic LookAndFeel

License

Open Source License

Declaration

public static boolean isWindowsClassicLookAndFeel() 

Method Source Code

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

import java.awt.Toolkit;

import javax.swing.UIManager;

public class Main {
    /**/*from   w  ww  . j  a va2s. com*/
     * Determines if current L&F is Windows Classic LookAndFeel
     */
    public static boolean isWindowsClassicLookAndFeel() {
        if (!isWindowsLookAndFeel()) {
            return false;
        }

        return (!isWindowsXPLookAndFeel() && !isWindowsVistaLookAndFeel());
    }

    /**
     * Determines if current L&F is WindowsLookAndFeel
     */
    public static boolean isWindowsLookAndFeel() {
        // is current L&F some kind of WindowsLookAndFeel?
        return UIManager.getLookAndFeel().getID().equals("Windows"); //NOI18N
    }

    /**
     * Determines if current L&F is Windows XP LookAndFeel
     */
    public static boolean isWindowsXPLookAndFeel() {
        if (!isWindowsLookAndFeel()) {
            return false;
        }

        // is XP theme active in the underlying OS?
        boolean xpThemeActiveOS = Boolean.TRUE
                .equals(Toolkit.getDefaultToolkit().getDesktopProperty("win.xpstyle.themeActive")); //NOI18N
        // is XP theme disabled by the application?

        boolean xpThemeDisabled = (System.getProperty("swing.noxp") != null); // NOI18N

        boolean vistaOs = System.getProperty("os.version").startsWith("6.0");

        return ((xpThemeActiveOS) && (!xpThemeDisabled) && !vistaOs);
    }

    public static boolean isWindowsVistaLookAndFeel() {
        if (!isWindowsLookAndFeel()) {
            return false;
        }

        // is XP theme active in the underlying OS?
        boolean xpThemeActiveOS = Boolean.TRUE
                .equals(Toolkit.getDefaultToolkit().getDesktopProperty("win.xpstyle.themeActive")); //NOI18N
        // is XP theme disabled by the application?

        boolean xpThemeDisabled = (System.getProperty("swing.noxp") != null); // NOI18N

        boolean vistaOs = System.getProperty("os.version").startsWith("6.0");

        return ((xpThemeActiveOS) && (!xpThemeDisabled) && vistaOs);
    }
}

Related

  1. isUnderIntelliJLaF()
  2. isUnderWindowsClassicLookAndFeel()
  3. isWebLookAndFeelInstalled()
  4. isWindows()
  5. isWindowsClassicLookAndFeel()
  6. isWindowsLaF()
  7. isWindowsLookAndFeel()
  8. isWindowsLookAndFeel()
  9. isWindowsModernLookAndFeel()