3 |
|
//---IMPORTS--- |
4 |
|
import javax.swing.*; |
5 |
|
import javax.swing.border.*; |
6 |
– |
import java.awt.Color; |
7 |
– |
import uk.ac.ukc.iscream.util.*; |
8 |
– |
|
6 |
|
import java.awt.*; |
7 |
|
import java.awt.event.*; |
11 |
– |
import java.net.*; |
12 |
– |
import java.io.*; |
13 |
– |
import java.util.Date; |
14 |
– |
import java.text.DateFormat; |
15 |
– |
import java.util.Locale; |
16 |
– |
import java.util.HashMap; |
17 |
– |
import javax.swing.border.*; |
8 |
|
|
9 |
|
/** |
10 |
< |
* NASTY AND BASIC, PLEASE DON'T COMPLAIN |
10 |
> |
* Root for the SwingClient...starts the whole show off... |
11 |
|
* |
12 |
|
* @author $Author$ |
13 |
|
* @version $Id$ |
45 |
|
// the main frame (passed the two panels) |
46 |
|
SwingClient client = new SwingClient(data, control); |
47 |
|
SwingClient.addMessage("Client started"); |
58 |
– |
SwingClient.setStatus("Disconnected"); |
48 |
|
} |
49 |
|
|
50 |
|
|
76 |
|
|
77 |
|
bottom.add(messagesPane, "Center"); |
78 |
|
JPanel statusPanel = new JPanel(); |
79 |
+ |
JPanel linkPanel = new JPanel(); |
80 |
+ |
linkPanel.setLayout(new GridLayout(2,1)); |
81 |
+ |
linkPanel.add(_controlStatus); |
82 |
+ |
linkPanel.add(_dataStatus); |
83 |
|
statusPanel.setLayout(new GridLayout(1,3)); |
84 |
< |
statusPanel.add(_status); |
92 |
< |
statusPanel.add(_dataLinkStatus); |
84 |
> |
statusPanel.add(linkPanel); |
85 |
|
statusPanel.add(_queueStatus); |
86 |
|
|
87 |
|
bottom.add(statusPanel, "South"); |
97 |
|
|
98 |
|
//---ACCESSOR/MUTATOR METHODS--- |
99 |
|
|
100 |
< |
public static void setStatus(String status) { |
101 |
< |
_status.setText(status); |
102 |
< |
_status.repaint(); |
100 |
> |
public static void setControlStatus(String status) { |
101 |
> |
_controlStatus.setText("Control Link: " + status); |
102 |
> |
_controlStatus.repaint(); |
103 |
|
} |
104 |
+ |
|
105 |
+ |
public static void setDataStatus(String status) { |
106 |
+ |
_dataStatus.setText("Data Link: " + status); |
107 |
+ |
_dataStatus.repaint(); |
108 |
+ |
} |
109 |
|
|
110 |
|
public static void setQueueStatus(int currentQueue, int numElements) { |
111 |
|
_queueStatus.setText("Data Queue : " + currentQueue + " Packets Recieved : " + numElements); |
115 |
|
public static void addMessage(String message) { |
116 |
|
_messages.insert(message + "\n", 0); |
117 |
|
} |
121 |
– |
//---ATTRIBUTES--- |
118 |
|
|
119 |
< |
static JLabel _status = new JLabel("Initialising", JLabel.LEFT); |
119 |
> |
//---ATTRIBUTES--- |
120 |
> |
|
121 |
> |
ImageIcon _serverIcon = new ImageIcon("server.gif"); |
122 |
> |
JLabel _serverCountLabel; |
123 |
> |
int _serverCount = 0; |
124 |
> |
|
125 |
> |
//---STATIC ATTRIBUTES--- |
126 |
> |
|
127 |
> |
static JLabel _controlStatus = new JLabel("Control Link: Disconnected", JLabel.LEFT); |
128 |
|
{ |
129 |
< |
_status.setBorder(new EtchedBorder(EtchedBorder.LOWERED)); |
129 |
> |
_controlStatus.setBorder(new EtchedBorder(EtchedBorder.LOWERED)); |
130 |
|
} |
131 |
|
|
132 |
< |
static JLabel _dataLinkStatus = new JLabel("Data Link Status here soon", JLabel.LEFT); |
132 |
> |
static JLabel _dataStatus = new JLabel("Data Link: Disconnected", JLabel.LEFT); |
133 |
|
{ |
134 |
< |
_dataLinkStatus.setBorder(new EtchedBorder(EtchedBorder.LOWERED)); |
134 |
> |
_dataStatus.setBorder(new EtchedBorder(EtchedBorder.LOWERED)); |
135 |
|
} |
136 |
|
|
137 |
< |
static JLabel _queueStatus = new JLabel("-", JLabel.LEFT); |
137 |
> |
static JLabel _queueStatus = new JLabel(" ", JLabel.LEFT); |
138 |
|
{ |
139 |
|
_queueStatus.setBorder(new EtchedBorder(EtchedBorder.LOWERED)); |
140 |
|
} |
137 |
– |
|
138 |
– |
ImageIcon _serverIcon = new ImageIcon("server.gif"); |
139 |
– |
JLabel _serverCountLabel; |
140 |
– |
int _serverCount = 0; |
141 |
|
static JTextArea _messages = new JTextArea(); |
142 |
– |
|
143 |
– |
//---STATIC ATTRIBUTES--- |
144 |
– |
|
142 |
|
} |