KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > openharmonise > him > configuration > lnf > ConfigLnF


1 /*
2  * The contents of this file are subject to the
3  * Mozilla Public License Version 1.1 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at http://www.mozilla.org/MPL/
6  *
7  * Software distributed under the License is distributed on an "AS IS"
8  * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied.
9  * See the License for the specific language governing rights and
10  * limitations under the License.
11  *
12  * The Initial Developer of the Original Code is Simulacra Media Ltd.
13  * Portions created by Simulacra Media Ltd are Copyright (C) Simulacra Media Ltd, 2004.
14  *
15  * All Rights Reserved.
16  *
17  * Contributor(s):
18  */

19 package org.openharmonise.him.configuration.lnf;
20
21 import javax.swing.SwingUtilities JavaDoc;
22 import javax.swing.UIManager JavaDoc;
23 import javax.swing.UnsupportedLookAndFeelException JavaDoc;
24
25 import org.openharmonise.him.configuration.*;
26 import org.openharmonise.him.window.*;
27
28
29 /**
30  * Class to represent Java Look and Feel options.
31  *
32  * @author Matthew Large
33  * @version $Revision: 1.1 $
34  *
35  */

36 public class ConfigLnF {
37
38     /**
39      * Configuration dialog.
40      */

41     private ConfigDialog m_dialog = null;
42
43     /**
44      *
45      */

46     protected ConfigLnF() {
47     }
48
49     /**
50      * Classname of Java Look and Feel.
51      */

52     private String JavaDoc m_sClassName = null;
53
54     /**
55      * Constructs a new look and feel option.
56      *
57      * @param sClassName Classname of Java Look and Feel
58      * @param dialog onfiguration dialog
59      */

60     public ConfigLnF(String JavaDoc sClassName, ConfigDialog dialog) {
61         super();
62         this.m_dialog = dialog;
63         this.m_sClassName = sClassName;
64     }
65     
66     /**
67      * Sets the Content Manager look and feel to this option.
68      *
69      */

70     public void setLookAndFeel() {
71         try {
72             UIManager.setLookAndFeel(m_sClassName);
73             SwingUtilities.updateComponentTreeUI(DisplayManager.getInstance().getMainWindow());
74             SwingUtilities.updateComponentTreeUI(this.m_dialog);
75         } catch (ClassNotFoundException JavaDoc e) {
76             e.printStackTrace();
77         } catch (InstantiationException JavaDoc e) {
78             e.printStackTrace();
79         } catch (IllegalAccessException JavaDoc e) {
80             e.printStackTrace();
81         } catch (UnsupportedLookAndFeelException JavaDoc e) {
82             e.printStackTrace();
83         }
84     }
85
86 }
87
Popular Tags