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

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

Introduction

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

Prototype

public static PlasticTheme createMyDefaultTheme() 

Source Link

Document

Creates and returns the default color theme.

Usage

From source file:etomica.virial.cluster2.mvc.view.JGoodiesSettings.java

License:Mozilla Public License

public static JGoodiesSettings createDefault() {

    JGoodiesSettings settings = new JGoodiesSettings();
    settings.setSelectedLookAndFeel(new PlasticXPLookAndFeel());
    settings.setSelectedTheme(PlasticLookAndFeel.createMyDefaultTheme());
    settings.setUseNarrowButtons(true);//from   w  w  w. ja va 2s .com
    settings.setTabIconsEnabled(true);
    settings.setPlasticTabStyle(PlasticLookAndFeel.TAB_STYLE_DEFAULT_VALUE);
    settings.setPlasticHighContrastFocusEnabled(false);
    settings.setPopupDropShadowEnabled(null);
    settings.setMenuBarHeaderStyle(null);
    settings.setMenuBarPlasticBorderStyle(null);
    settings.setMenuBarWindowsBorderStyle(null);
    settings.setMenuBar3DHint(null);
    settings.setToolBarHeaderStyle(null);
    settings.setToolBarPlasticBorderStyle(null);
    settings.setToolBarWindowsBorderStyle(null);
    settings.setToolBar3DHint(null);
    return settings;
}

From source file:net.pms.newgui.LooksFrame.java

License:Open Source License

static void initializeLookAndFeel() {
    if (lookAndFeelInitialized) {
        return;/* ww w .  ja  v  a 2 s .  co m*/
    }

    LookAndFeel selectedLaf = null;
    if (Platform.isWindows()) {
        try {
            selectedLaf = (LookAndFeel) Class.forName("com.jgoodies.looks.windows.WindowsLookAndFeel")
                    .newInstance();
        } catch (Exception e) {
            selectedLaf = new PlasticLookAndFeel();
        }
    } else if (System.getProperty("nativelook") == null && !Platform.isMac()) {
        selectedLaf = new PlasticLookAndFeel();
    } else {
        try {
            String systemClassName = UIManager.getSystemLookAndFeelClassName();
            // workaround for Gnome
            try {
                String gtkLAF = "com.sun.java.swing.plaf.gtk.GTKLookAndFeel";
                Class.forName(gtkLAF);

                if (systemClassName.equals("javax.swing.plaf.metal.MetalLookAndFeel")) {
                    systemClassName = gtkLAF;
                }
            } catch (ClassNotFoundException ce) {
                logger.error("Error loading GTK look and feel: ", ce);
            }

            logger.trace("Choosing Java look and feel: " + systemClassName);
            UIManager.setLookAndFeel(systemClassName);
        } catch (Exception e1) {
            selectedLaf = new PlasticLookAndFeel();
            logger.error("Error while setting native look and feel: ", e1);
        }
    }

    if (selectedLaf instanceof PlasticLookAndFeel) {
        PlasticLookAndFeel.setPlasticTheme(PlasticLookAndFeel.createMyDefaultTheme());
        PlasticLookAndFeel.setTabStyle(PlasticLookAndFeel.TAB_STYLE_DEFAULT_VALUE);
        PlasticLookAndFeel.setHighContrastFocusColorsEnabled(false);
    } else if (selectedLaf != null && 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);

    if (selectedLaf != null) {
        try {
            UIManager.setLookAndFeel(selectedLaf);
        } catch (UnsupportedLookAndFeelException e) {
            logger.warn("Can't change look and feel", e);
        }
    }

    lookAndFeelInitialized = true;
}

From source file:org.columba.core.gui.themes.plugin.PlasticLookAndFeelPlugin.java

License:Mozilla Public License

/**
 * @see org.columba.core.gui.themes.plugin.AbstractThemePlugin#setLookAndFeel()
 *//*from  www.  j  a  v a  2  s . c  o m*/
public void setLookAndFeel() throws Exception {

    Options.setDefaultIconSize(new Dimension(16, 16));
    Options.setUseNarrowButtons(false);
    Options.setPopupDropShadowEnabled(true);

    XmlElement options = Config.getInstance().get("options").getElement("/options");
    XmlElement gui = options.getElement("gui");
    XmlElement themeElement = gui.getElement("theme");

    try {
        // UIManager.setLookAndFeel(lafName);
        String theme = themeElement.getAttribute("theme");

        if (theme != null) {
            PlasticTheme t = getTheme(theme);
            LookUtils.setLookAndTheme(new PlasticXPLookAndFeel(), t);
        } else {
            PlasticTheme t = PlasticLookAndFeel.createMyDefaultTheme();
            LookUtils.setLookAndTheme(new PlasticXPLookAndFeel(), t);
        }

    } catch (Exception e) {
        System.err.println("Can't set look & feel:" + e);
    }

    ;
}

From source file:org.qedeq.gui.se.main.GuiOptions.java

License:Open Source License

/**
 * Constructor.//from   w w w . ja  va  2 s  .  c o m
 */
public GuiOptions() {
    setSelectedLookAndFeel(new PlasticXPLookAndFeel());
    setSelectedTheme(PlasticLookAndFeel.createMyDefaultTheme());
    setUseNarrowButtons(true);
    setTabIconsEnabled(true);
    setPlasticTabStyle(PlasticLookAndFeel.TAB_STYLE_DEFAULT_VALUE);
    setPlasticHighContrastFocusEnabled(false);
    setPopupDropShadowEnabled(null);
    setMenuBarHeaderStyle(null);
    setMenuBarPlasticBorderStyle(null);
    setMenuBarWindowsBorderStyle(null);
    setMenuBar3DHint(null);
    setToolBarHeaderStyle(null);
    setToolBarPlasticBorderStyle(null);
    setToolBarWindowsBorderStyle(null);
    setToolBar3DHint(null);
}

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

License:Open Source License

private static void initPlasticThemes() {
    if (plasticThemes == null) {

        PlasticTheme theme = PlasticLookAndFeel.createMyDefaultTheme();
        String defaultName = theme.getClass().getName();

        String classPrefix = "com.jgoodies.looks.plastic.theme.";
        plasticThemes = new ThemeInfo[THEME_NAMES.length];

        String displayName;/*w w w  .  j  a va2  s.  c om*/
        String name;
        for (int i = 0; i < THEME_NAMES.length; i++) {
            displayName = name = THEME_NAMES[i];
            if (defaultName.endsWith(name)) {
                displayName = name + " (default)";
            }
            plasticThemes[i] = new ThemeInfo(displayName, classPrefix + name);
        }
    }
}

From source file:tvbrowser.core.settings.JGoodiesThemeProperty.java

License:Open Source License

@Override
public String getDefault() {
    if (mCachedValue == null) {
        if (!GraphicsEnvironment.isHeadless()) {
            mCachedValue = PlasticLookAndFeel.createMyDefaultTheme().getClass().getName();
        }//from w  w w . j  a v a  2s .  c  om
    }
    if (mCachedValue == null) {
        mCachedValue = "";
    }
    return mCachedValue;
}

From source file:tvbrowser.ui.settings.looksSettings.JGoodiesLNFSettings.java

License:Open Source License

/**
 * Create the GUI/*from w w  w.j a  v a  2 s  .co  m*/
 */
private void createGui() {
    final List themesList = PlasticLookAndFeel.getInstalledThemes();
    PlasticTheme[] themes = (PlasticTheme[]) themesList.toArray(new PlasticTheme[themesList.size()]);

    JPanel content = (JPanel) getContentPane();

    content.setLayout(new FormLayout("pref, 3dlu, fill:pref:grow", "pref, 3dlu, pref, fill:3dlu:grow, pref"));
    content.setBorder(Borders.DLU4_BORDER);

    CellConstraints cc = new CellConstraints();

    content.add(new JLabel(mLocalizer.msg("colorTheme", "Color-Theme") + ":"), cc.xy(1, 1));

    mColorScheme = new JComboBox(themes);
    mColorScheme.setRenderer(new DefaultListCellRenderer() {
        public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected,
                boolean cellHasFocus) {
            JLabel label = (JLabel) super.getListCellRendererComponent(list, value, index, isSelected,
                    cellHasFocus);
            label.setText(((PlasticTheme) value).getName());
            return label;
        }
    });

    String theme = Settings.propJGoodiesTheme.getString();
    if (theme == null) {
        theme = PlasticLookAndFeel.createMyDefaultTheme().getClass().getName();
    }

    for (int i = 0; i < themes.length; i++) {
        if (themes[i].getClass().getName().equals(theme)) {
            mColorScheme.setSelectedIndex(i);
        }
    }

    content.add(mColorScheme, cc.xy(3, 1));

    mShadow = new JCheckBox(mLocalizer.msg("dropShadow", "Drop Shadow on Menus"));
    mShadow.setSelected(Settings.propJGoodiesShadow.getBoolean());
    content.add(mShadow, cc.xyw(1, 3, 3));

    JButton ok = new JButton(Localizer.getLocalization(Localizer.I18N_OK));
    ok.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            okPressed();
        }
    });

    JButton cancel = new JButton(Localizer.getLocalization(Localizer.I18N_CANCEL));
    cancel.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            cancelPressed();
        }
    });

    ButtonBarBuilder2 bar = new ButtonBarBuilder2();
    bar.addButton(new JButton[] { ok, cancel });

    JPanel panel = new JPanel(new FlowLayout(FlowLayout.RIGHT, 0, 0));
    panel.add(bar.getPanel());
    content.add(panel, cc.xyw(1, 5, 3));

    UiUtilities.registerForClosing(this);

    pack();
}