Java Swing UIManager prepareTheme(final String overrideEnvVar)

Here you can find the source of prepareTheme(final String overrideEnvVar)

Description

Prepares the theme.

License

Open Source License

Parameter

Parameter Description
overrideEnvVar The environment variable to check for override value. Specify null for don't use override variable

Exception

Parameter Description
Exception When setting the theme failed

Declaration


public static void prepareTheme(final String overrideEnvVar) throws Exception 

Method Source Code

//package com.java2s;
/*//from   w  w w  . j av a  2  s. c o m
 * Copyright (C) 2009 Klaus Reimer <k@ailis.de> 
 * See LICENSE.md for licensing information.
 */

import javax.swing.UIManager;

public class Main {
    /**
     * Prepares the theme. The theme can be overridden with the specified environment variable. The default is the
     * system look and feel.
     *
     * @param overrideEnvVar
     *            The environment variable to check for override value. Specify null for don't use override variable
     * @throws Exception
     *             When setting the theme failed
     */

    public static void prepareTheme(final String overrideEnvVar) throws Exception {
        final String sysThemeStr = overrideEnvVar == null ? null : System.getenv().get(overrideEnvVar);
        System.setProperty("apple.laf.useScreenMenuBar", "true");
        if (sysThemeStr == null || Boolean.parseBoolean(sysThemeStr)) {
            UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
        }
    }
}

Related

  1. paintFocus(Graphics2D g, Shape shape, int biggestStroke)
  2. paintFocus(Graphics2D g, Shape shape, int biggestStroke)
  3. paintUnderlying(Graphics g, JComponent c)
  4. paintXpTabHeader(int type, Graphics g, int x, int y, int width)
  5. prepareGUI(final String appName)
  6. printDefaults()
  7. printUIDefaults()
  8. setComponentLF(JComponent comp, String ui)
  9. setCrossPlatformProperties()