1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20 package org.xnap.plugin;
21
22 import org.xnap.gui.*;
23
24 import javax.swing.UIManager;
25
26 /***
27 * Provides the default implementation for look and feel plugin classes.
28 */
29 public abstract class AbstractLAFPlugin extends AbstractPlugin
30 {
31
32
33
34
35
36 private String className;
37
38
39
40 public AbstractLAFPlugin(String className)
41 {
42 this.className = className;
43 }
44
45 public AbstractLAFPlugin()
46 {
47 }
48
49
50
51 /***
52 * Registers the Look And Feel. We need to do this before the gui is
53 * started (except for the SplashWindow).
54 *
55 * @see Plugin#start()
56 */
57 public void start()
58 {
59 installLookAndFeel();
60 }
61
62 /***
63 * Updates the look and feel menu.
64 *
65 * @see Plugin#startGUI()
66 */
67 public void startGUI()
68 {
69 XNapFrame.getInstance().getMainMenuBar().updateLookAndFeels();
70 }
71
72 /***
73 * Does nothing.
74 *
75 * @see Plugin#stop()
76 */
77 public void stop()
78 {
79 }
80
81 /***
82 * Updates the look and feel menu.
83 *
84 * @see Plugin#stopGUI()
85 */
86 public void stopGUI()
87 {
88 XNapFrame.getInstance().getMainMenuBar().updateLookAndFeels();
89 }
90
91 public void installLookAndFeel()
92 {
93 if (className != null) {
94 UIManager.installLookAndFeel(getInfo().getName(), className);
95 }
96 }
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116 }