List of usage examples for com.jgoodies.looks LookUtils setLookAndTheme
public static void setLookAndTheme(LookAndFeel laf, Object theme) throws UnsupportedLookAndFeelException
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 ww w . jav a 2s.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.librazur.blc.Main.java
License:Open Source License
private static void installLF() { log.info("Installing Swing L&F"); try {/* w w w. j av a 2 s .c o m*/ LookUtils.setLookAndTheme(new PlasticXPLookAndFeel(), new ExperienceBlue()); } catch (Exception e) { log.warn("Error while setting Swing L&F", e); } }
From source file:org.librazur.ict.Main.java
License:Open Source License
private static void installLF() { try {/*from w w w.j av a2 s . c o m*/ LookUtils.setLookAndTheme(new PlasticXPLookAndFeel(), new ExperienceBlue()); } catch (Exception e) { e.printStackTrace(); } }
From source file:tvbrowser.TVBrowser.java
License:Open Source License
private static void updateLookAndFeel() { try {/*w w w. j a va2 s. c om*/ if (OperatingSystem.isWindows()) { UIManager.installLookAndFeel("Extended Windows", "com.jgoodies.looks.windows.WindowsLookAndFeel"); } UIManager.installLookAndFeel("Plastic", "com.jgoodies.looks.plastic.PlasticLookAndFeel"); UIManager.installLookAndFeel("Plastic 3D", "com.jgoodies.looks.plastic.Plastic3DLookAndFeel"); UIManager.installLookAndFeel("Plastic XP", "com.jgoodies.looks.plastic.PlasticXPLookAndFeel"); UIManager.installLookAndFeel("Skin", "com.l2fprod.gui.plaf.skin.SkinLookAndFeel"); /* Map<String, SkinInfo> substanceSkins = SubstanceLookAndFeel.getAllSkins(); if (substanceSkins != null) { for (SkinInfo skin : substanceSkins.values()) { String className = skin.getClassName(); UIManager.installLookAndFeel("Substance " + skin.getDisplayName(), StringUtils.replace(StringUtils.replace(className, "Skin", "LookAndFeel"), "skin.", "skin.Substance")); } } */ } catch (Exception e1) { // ignore any exception for optional skins e1.printStackTrace(); } if (Settings.propLookAndFeel.getString().equals("com.l2fprod.gui.plaf.skin.SkinLookAndFeel")) { String themepack = Settings.propSkinLFThemepack.getString(); try { File themepackFile = new File(themepack); if (!themepackFile.exists()) { themepackFile = new File(Settings.getUserDirectoryName(), themepack); } if (!themepackFile.exists() && OperatingSystem.isMacOs()) { themepackFile = new File("/Library/Application Support/TV-Browser/", themepack); } SkinLookAndFeel.setSkin(SkinLookAndFeel.loadThemePack(themepackFile.getAbsolutePath())); } catch (Exception exc) { ErrorHandler.handle("Could not load themepack.\nSkinLF is disabled now", exc); Settings.propLookAndFeel.setString(Settings.propLookAndFeel.getDefault()); } } else if (Settings.propLookAndFeel.getString().startsWith("com.jgoodies")) { com.jgoodies.looks.Options.setPopupDropShadowEnabled(Settings.propJGoodiesShadow.getBoolean()); UIManager.put("jgoodies.popupDropShadowEnabled", Boolean.valueOf(Settings.propJGoodiesShadow.getBoolean())); try { LookUtils.setLookAndTheme( (LookAndFeel) Class.forName(Settings.propLookAndFeel.getString()).newInstance(), Class.forName(Settings.propJGoodiesTheme.getString()).newInstance()); } catch (Throwable e) { ErrorHandler.handle("Could not load themepack.\nJGoodies is disabled now", e); Settings.propLookAndFeel.setString(Settings.propLookAndFeel.getDefault()); } } if (curLookAndFeel == null || !curLookAndFeel.equals(Settings.propLookAndFeel.getString())) { try { curLookAndFeel = Settings.propLookAndFeel.getString(); // check if LnF is still available boolean foundCurrent = lookAndFeelExists(curLookAndFeel); // reset look and feel? if (!foundCurrent) { if (JOptionPane.showConfirmDialog(null, mLocalizer.msg("lnfMissing", "The look and feel '{0}' is no longer available,\nso the default look and feel will be used.\n\nDo you want to set the look and feel option to the default look and feel?", curLookAndFeel), mLocalizer.msg("lnfMissing.title", "Look and feel missing"), JOptionPane.WARNING_MESSAGE | JOptionPane.YES_NO_OPTION) == JOptionPane.YES_OPTION) { Settings.propLookAndFeel.resetToDefault(); curLookAndFeel = Settings.propLookAndFeel.getString(); foundCurrent = true; } } if (foundCurrent) { UIThreadRunner.invokeAndWait(new Runnable() { @Override public void run() { try { UIManager.setLookAndFeel(curLookAndFeel); } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); } mLog.info("setting look and feel to " + curLookAndFeel); } }); } } catch (Exception exc) { String msg = mLocalizer.msg("error.1", "Unable to set look and feel.", exc); ErrorHandler.handle(msg, exc); } } // set colors for action pane at UIManager UIManager.put("TaskPane.foreGround", UIManager.get("Button.foreground")); if (UIManager.getColor("List.selectionBackground") == null) { UIManager.put("List.selectionBackground", UIManager.getColor("Tree.selectionBackground")); } if (UIManager.getColor("List.selectionForeground") == null) { UIManager.put("List.selectionForeground", UIManager.getColor("Tree.selectionForeground")); } if (UIManager.getColor("MenuItem.selectionForeground") == null) { UIManager.put("MenuItem.selectionForeground", UIManager.getColor("Tree.selectionForeground")); } if (UIManager.getColor("ComboBox.disabledForeground") == null) { UIManager.put("ComboBox.disabledForeground", Color.gray); } if (mainFrame != null) { SwingUtilities.updateComponentTreeUI(mainFrame); mainFrame.validate(); } lookAndFeelInitialized = true; }