1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19 package org.xnap.plugin.overnet.gui;
20
21 import javax.swing.SwingUtilities;
22
23 import org.xnap.event.StateEvent;
24 import org.xnap.event.StateListener;
25 import org.xnap.gui.StatusPanel;
26 import org.xnap.plugin.overnet.OvernetPlugin;
27 import org.xnap.plugin.overnet.net.OvernetCore;
28
29
30 /***
31 * Overnet's status panel displaying the state of its connection to the core.
32 */
33 public class OvernetStatusPanel extends StatusPanel implements StateListener
34 {
35 public OvernetStatusPanel()
36 {
37 setName(OvernetPlugin.getInstance().getInfo().getName());
38 setIcon(OvernetPlugin.ICON_16);
39 setText(OvernetPlugin.getInstance().getCore().getState().getDescription());
40 }
41
42
43
44
45 public void stateChanged(StateEvent event)
46 {
47 OvernetCore core = (OvernetCore)event.getSource();
48 final String status = core.getState().getDescription();
49 Runnable r = new Runnable()
50 {
51 public void run()
52 {
53 setText(status);
54 }
55 };
56 SwingUtilities.invokeLater(r);
57 }
58 }