1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20 package org.xnap.plugin.joscar;
21
22 import javax.swing.Icon;
23
24 import org.apache.log4j.Logger;
25 import org.xnap.event.StateEvent;
26 import org.xnap.event.StateListener;
27 import org.xnap.gui.StatusPanel;
28 import org.xnap.gui.util.IconHelper;
29 import org.xnap.util.State;
30
31 public class JOscarStatusPanel extends StatusPanel implements StateListener
32 {
33
34
35 private static final Icon offline =
36 IconHelper.getIcon("licq-offline.png", 16, false);
37
38
39
40 private static Logger logger = Logger.getLogger(JOscarStatusPanel.class);
41
42
43
44 public JOscarStatusPanel()
45 {
46 super(JOscarPlugin.ICON_16);
47 stateChanged(null);
48 }
49
50
51
52 public void stateChanged(StateEvent event)
53 {
54 State s = JOscarPlugin.getInstance().getConnection().getState();
55 setStatus(s.getDescription());
56 if (s == State.DISCONNECTED) {
57 setIcon(offline);
58 }
59 if (s == State.CONNECTED) {
60 setIcon(JOscarPlugin.ICON_16);
61 }
62 }
63 }