001: /*
002: * The contents of this file are subject to the
003: * Mozilla Public License Version 1.1 (the "License");
004: * you may not use this file except in compliance with the License.
005: * You may obtain a copy of the License at http://www.mozilla.org/MPL/
006: *
007: * Software distributed under the License is distributed on an "AS IS"
008: * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied.
009: * See the License for the specific language governing rights and
010: * limitations under the License.
011: *
012: * The Initial Developer of the Original Code is Simulacra Media Ltd.
013: * Portions created by Simulacra Media Ltd are Copyright (C) Simulacra Media Ltd, 2004.
014: *
015: * All Rights Reserved.
016: *
017: * Contributor(s):
018: */
019: package org.openharmonise.him.configuration.lnf;
020:
021: import java.io.*;
022:
023: import javax.swing.*;
024:
025: import org.openharmonise.him.configuration.*;
026: import org.openharmonise.him.window.*;
027:
028: import com.l2fprod.gui.plaf.skin.*;
029:
030: /**
031: * Class to represent SkinLnF skin options.
032: *
033: * @author Matthew Large
034: * @version $Revision: 1.1 $
035: *
036: */
037: public class ConfigSkinLnF extends ConfigLnF {
038:
039: /**
040: * Configuration dialog.
041: */
042: private ConfigDialog m_dialog = null;
043:
044: /**
045: * Skin name
046: */
047: private String m_sTheme = null;
048:
049: /**
050: * Constructs a new look and feel option.
051: *
052: * @param sTheme Skin name
053: * @param dialog Configuration dialog
054: */
055: public ConfigSkinLnF(String sTheme, ConfigDialog dialog) {
056: super ();
057: this .m_dialog = dialog;
058: this .m_sTheme = sTheme;
059: }
060:
061: /* (non-Javadoc)
062: * @see com.simulacramedia.contentmanager.configuration.lnf.ConfigLnF#setLookAndFeel()
063: */
064: public void setLookAndFeel() {
065: Skin skin = null;
066: try {
067:
068: InputStream is = ConfigSkinLnF.class
069: .getResourceAsStream(m_sTheme);
070:
071: skin = SkinLookAndFeel.loadThemePack(is);
072:
073: SkinLookAndFeel.setSkin(skin);
074: SkinLookAndFeel.enable();
075:
076: String lookAndFeelClassName = "com.l2fprod.gui.plaf.skin.SkinLookAndFeel";
077:
078: UIManager.setLookAndFeel(lookAndFeelClassName);
079:
080: JFrame frame = DisplayManager.getInstance().getMainWindow();
081:
082: if (frame != null) {
083: SwingUtilities.updateComponentTreeUI(frame);
084: }
085:
086: if (this .m_dialog != null) {
087: SwingUtilities.updateComponentTreeUI(this .m_dialog);
088: }
089: } catch (UnsupportedLookAndFeelException e) {
090: e.printStackTrace();
091: } catch (ClassNotFoundException e) {
092: e.printStackTrace();
093: } catch (InstantiationException e) {
094: e.printStackTrace();
095: } catch (IllegalAccessException e) {
096: e.printStackTrace();
097: } catch (Exception e) {
098: e.printStackTrace();
099: }
100: }
101:
102: }
|