Java Swing UIManager getWindowsVisualStyle()

Here you can find the source of getWindowsVisualStyle()

Description

Returns the name of the current Windows visual style.

License

Open Source License

Return

the name of the current Windows visual style if any.

Declaration

public static String getWindowsVisualStyle() 

Method Source Code


//package com.java2s;
/*//ww  w .java2s .  c  o  m
 * Copyright 2004 Sun Microsystems, Inc., 4150 Network Circle,
 * Santa Clara, California 95054, U.S.A. All rights reserved.
 *
 * 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 2.1 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; without 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., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 */

import java.awt.Toolkit;
import javax.swing.UIManager;

public class Main {
    /**
     * Returns the name of the current Windows visual style.
     * <ul>
     * <li>it looks for a property name "win.xpstyle.name" in UIManager and if
     * not found
     * <li>it queries the win.xpstyle.colorName desktop property (
     * {@link Toolkit#getDesktopProperty(java.lang.String)})
     * </ul>
     * 
     * @return the name of the current Windows visual style if any.
     */
    public static String getWindowsVisualStyle() {
        String style = UIManager.getString("win.xpstyle.name");
        if (style == null) {
            // guess the name of the current XPStyle
            // (win.xpstyle.colorName property found in
            // awt_DesktopProperties.cpp in
            // JDK source)
            style = (String) Toolkit.getDefaultToolkit().getDesktopProperty("win.xpstyle.colorName");
        }
        return style;
    }
}

Related

  1. getUIPanelBackground()
  2. getUnfocusedSelectionBackground()
  3. getUnfocusedSelectionForeground()
  4. getUnfocusedSelectionForeground()
  5. getUnfocusedSelectionForeground()
  6. GUI_unit(double p_GUI_unit, java.awt.Component c)
  7. init()
  8. initComponentHeight(final Component... components)
  9. initGui()