Example usage for com.jgoodies.looks.plastic PlasticLookAndFeel setPlasticTheme

List of usage examples for com.jgoodies.looks.plastic PlasticLookAndFeel setPlasticTheme

Introduction

In this page you can find the example usage for com.jgoodies.looks.plastic PlasticLookAndFeel setPlasticTheme.

Prototype

public static void setPlasticTheme(PlasticTheme theme) 

Source Link

Document

Sets the theme for colors and fonts used by the Plastic L&F.

After setting the theme, you need to re-install the Look&Feel, as well as update the UI's of any previously created components - just as if you'd change the Look&Feel.

Usage

From source file:org.pdfsam.guiclient.utils.ThemeUtility.java

License:Open Source License

/**
 * Sets the theme//from w ww . ja v a  2  s  .c  o  m
 * @param themeNumber Theme number
 */
public static void setTheme(int themeNumber) {
    switch (themeNumber) {
    case 1:
        PlasticLookAndFeel.setPlasticTheme(new DesertBlue());
        break;
    case 2:
        PlasticLookAndFeel.setPlasticTheme(new DesertRed());
        break;
    case 3:
        PlasticLookAndFeel.setPlasticTheme(new Silver());
        break;
    case 4:
        PlasticLookAndFeel.setPlasticTheme(new SkyPink());
        break;
    case 5:
        PlasticLookAndFeel.setPlasticTheme(new SkyKrupp());
        break;
    case 6:
        PlasticLookAndFeel.setPlasticTheme(new SkyYellow());
        break;
    case 7:
        PlasticLookAndFeel.setPlasticTheme(new SkyGreen());
        break;
    case 8:
        PlasticLookAndFeel.setPlasticTheme(new DarkStar());
        break;
    case 9:
        PlasticLookAndFeel.setPlasticTheme(new BrownSugar());
        break;
    case 10:
        PlasticLookAndFeel.setPlasticTheme(new DesertGreen());
        break;
    case 11:
        PlasticLookAndFeel.setPlasticTheme(new ExperienceBlue());
        break;
    case 12:
        PlasticLookAndFeel.setPlasticTheme(new ExperienceGreen());
        break;
    case 13:
        PlasticLookAndFeel.setPlasticTheme(new SkyBlue());
        break;
    case 14:
        PlasticLookAndFeel.setPlasticTheme(new SkyBluer());
        break;
    default:
        break;
    }
}

From source file:org.qedeq.gui.se.util.GuiHelper.java

License:Open Source License

/**
 * Configures the user interface; requests Swing settings and JGoodies Looks
 * options from the launcher./*from w w w .j  a v a2  s  .  c  om*/
 *
 * @param   options Set these options.
 */
public static void configureUI(final GuiOptions options) {
    UIManager.put("ClassLoader", CLASS.getClassLoader());

    Options.setDefaultIconSize(new Dimension(18, 18));
    Options.setUseNarrowButtons(options.isUseNarrowButtons());
    Options.setTabIconsEnabled(options.isTabIconsEnabled());
    UIManager.put(Options.POPUP_DROP_SHADOW_ENABLED_KEY, options.isPopupDropShadowEnabled());
    // LATER m31 20100319: we make this now direct in QedeqPane, this line
    // didn't help. Why?
    // we want our disabled TextAreas to look same if not editable
    UIManager.put("TextArea.disabledBackground", UIManager.get("TextArea.background"));

    UIManager.put("ToolTip.font",
            new FontUIResource("Lucida Sans Unicode", Font.PLAIN, UIManager.getFont("ToolTip.font").getSize()));

    // Swing Settings
    LookAndFeel selectedLaf = options.getSelectedLookAndFeel();
    if (selectedLaf instanceof PlasticLookAndFeel) {
        PlasticLookAndFeel.setPlasticTheme(options.getSelectedTheme());
        PlasticLookAndFeel.setTabStyle(options.getPlasticTabStyle());
        PlasticLookAndFeel.setHighContrastFocusColorsEnabled(options.isPlasticHighContrastFocusEnabled());
    } else if (selectedLaf.getClass() == MetalLookAndFeel.class) {
        MetalLookAndFeel.setCurrentTheme(new DefaultMetalTheme());
    }

    // Work around caching in MetalRadioButtonUI
    JRadioButton radio = new JRadioButton();
    radio.getUI().uninstallUI(radio);
    JCheckBox checkBox = new JCheckBox();
    checkBox.getUI().uninstallUI(checkBox);

    try {
        UIManager.setLookAndFeel(selectedLaf);
    } catch (Exception e) {
        Trace.trace(CLASS, "configureUI", "Can't change L&F", e);
    }

}

From source file:org.qi4j.envisage.Envisage.java

License:Apache License

private void initLookAndFeel() {
    String osName = System.getProperty("os.name").toUpperCase();

    // set to use swing anti alias text only for JVM <= 1.5
    System.setProperty("swing.aatext", "true");

    // set default swing bold to false, only for JVM 1.5 or above
    UIManager.put("swing.boldMetal", Boolean.FALSE);

    // set LaF/*  w  w  w.  j a  v a  2 s  .c o  m*/
    LookAndFeel lnf = UIManager.getLookAndFeel();
    if (lnf != null && lnf.getID().equalsIgnoreCase("Metal")) {
        final String lnfClassName;
        if (osName.startsWith("MAC")) {
            System.setProperty("com.apple.mrj.application.apple.menu.about.name", "Envisage"); //TODO i18n
            System.setProperty("apple.laf.useScreenMenuBar", "true");
            lnfClassName = UIManager.getSystemLookAndFeelClassName();
        } else if (osName.startsWith("WINDOWS")) {
            UIManager.put("ClassLoader", LookUtils.class.getClassLoader());
            lnfClassName = Options.getSystemLookAndFeelClassName();
            Options.setUseNarrowButtons(false);
        } else {
            UIManager.put("ClassLoader", LookUtils.class.getClassLoader());
            lnfClassName = Options.getCrossPlatformLookAndFeelClassName();
            PlasticLookAndFeel.setTabStyle(PlasticLookAndFeel.TAB_STYLE_METAL_VALUE);
            PlasticLookAndFeel.setPlasticTheme(new ExperienceBlue());
            Options.setUseNarrowButtons(false);
            //PlasticLookAndFeel.setMyCurrentTheme(new ExperienceBlueDefaultFont());  // for CJK Font
        }

        if (lnfClassName != null) {
            try {
                UIManager.setLookAndFeel(lnfClassName);
            } catch (Exception ex) {
                System.err.println("Unable to set LookAndFeel, use default LookAndFeel.\n" + ex.getMessage());
            }
        }
    }
}

From source file:org.schreibubi.JCombinations.ui.MainWindow.java

License:Open Source License

/**
 * @param args//from   w w w .ja va2s  . c om
 */
public static void main(String[] args) {
    PlasticLookAndFeel.setPlasticTheme(new ExperienceBlue());
    try {
        UIManager.setLookAndFeel(new PlasticXPLookAndFeel());
        // UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
    } catch (Exception e) {
    }

    MainWindow.logger.info("Program started");
    // LoggerContext lc = (LoggerContext) LoggerFactory.getILoggerFactory();
    // StatusPrinter.print(lc);

    MainWindow application = new MainWindow();
    application.setVisible(true);
}

From source file:org.springframework.richclient.application.config.JGoodiesLooksConfigurer.java

License:Apache License

/**
 * @param theme PlasticTheme to use.//w w  w  .ja  v  a2 s  .  co m
 * @see com.jgoodies.looks.plastic.PlasticLookAndFeel#setPlasticTheme(com.jgoodies.looks.plastic.PlasticTheme)
 */
public void setTheme(PlasticTheme theme) {
    PlasticLookAndFeel.setPlasticTheme(theme);
}

From source file:papertoolkit.PaperToolkit.java

License:BSD License

/**
 * Sets up parameters for any Java Swing UI we need. Feel free to call this from an external class. If you
 * use the default PaperToolkit() constructor, it will also use the custom look and feel. All PaperToolkit
 * utility classes will also use this look and feel.
 *///from   www .  ja v a  2s  .  c  o m
public static void initializeLookAndFeel() {
    if (!lookAndFeelInitialized) {
        // JGoodies Look and Feel
        try {
            final DarkStar theme = new DarkStar();
            PlasticLookAndFeel.setPlasticTheme(theme);
            UIManager.setLookAndFeel(new PlasticXPLookAndFeel());
        } catch (Exception e) {
        }
        lookAndFeelInitialized = true;
    }
}

From source file:phex.gui.common.LookAndFeelUtils.java

License:Open Source License

public static void setCurrentTheme(String lafClassName, Object theme) {
    if (lafClassName.equals(Options.PLASTICXP_NAME)) {
        PlasticLookAndFeel.setPlasticTheme((PlasticTheme) theme);
        try {//from www  . j  a  va2 s  .  c  o m
            // after setting the theme we must reset the PlasticLAF
            UIManager.setLookAndFeel(UIManager.getLookAndFeel());
        } catch (UnsupportedLookAndFeelException exp) {// this is not expected to happen since we reset a existing LAF
            logger.error(exp.toString(), exp);
        }
    }
    GUIUtils.updateComponentsUI();
}

From source file:photosrenamer.Main.java

License:Creative Commons License

/**
 * Shows the Files Renamer window./*from w  ww  .  j  ava 2  s  .  c o m*/
 * 
 * @param args
 *        Command line arguments.
 */
public static void main(final String[] args) {
    try {
        logger.setLevel(Level.ALL);

        PlasticLookAndFeel.setPlasticTheme(new LightGray());
        UIManager.setLookAndFeel(new PlasticLookAndFeel());
    } catch (final Exception e) {
        logger.log(Level.WARNING, e.getMessage(), e);
    }

    new PhotosRenamerWindow().setVisible(true);
}

From source file:ppciarravano.algoexplorer.gui.GuiUtility.java

License:Open Source License

public static void setLookAndFeel() {
    if (ConstantManager.NOT_STANDARD_LOOK_AND_FEEL) {
        PlasticLookAndFeel.setPlasticTheme(new DesertBlue());
        try {/*from   w  ww  .j av  a2 s.c  o m*/
            //UIManager.setLookAndFeel(new PlasticXPLookAndFeel());
            //UIManager.setLookAndFeel(new Plastic3DLookAndFeel());
            UIManager.setLookAndFeel(new PlasticLookAndFeel());
        } catch (Exception e) {
            Logger.log.error("setLookAndFeel Exception:\n" + Logger.exceptionToString(e));
        }

    }
}

From source file:simplesqlformatter.Main.java

License:Creative Commons License

private static void doWindow(final boolean debug) {
    try {//from w  w  w. j  a va2  s  . c  o  m
        PlasticLookAndFeel.setPlasticTheme(new LightGray());
        UIManager.setLookAndFeel(new PlasticLookAndFeel());
    } catch (final Exception e) {
        LOGGER.log(Level.WARNING, "Cannot set look and feel");
    }

    new SQLFormatterEditor(debug).setVisible(true);
}