29 |
|
*/ |
30 |
|
public final String REVISION = "$Revision$"; |
31 |
|
|
32 |
< |
private final int width = 300; |
32 |
> |
private final int width = 400; |
33 |
|
private final int height = 700; |
34 |
|
|
35 |
|
//---STATIC METHODS--- |
36 |
|
|
37 |
|
public static void main(String[] args) { |
38 |
|
try { |
39 |
< |
String host = args[0]; |
39 |
> |
String host = null; |
40 |
> |
if (args.length != 1) { |
41 |
> |
Object response = null; |
42 |
> |
while(!(response instanceof String)) { |
43 |
> |
response = JOptionPane.showInputDialog(null, "Please enter the name of a server running the I-Scream client interface:", "I-Scream Server", JOptionPane.INFORMATION_MESSAGE); |
44 |
> |
} |
45 |
> |
host = (String) response; |
46 |
> |
} else { |
47 |
> |
host = args[0]; |
48 |
> |
} |
49 |
> |
|
50 |
|
int port = 4510; |
51 |
|
Socket socket = new Socket(host, port); |
52 |
|
BufferedReader inBound = new BufferedReader(new InputStreamReader(socket.getInputStream())); |
53 |
|
PrintWriter outBound = new PrintWriter(socket.getOutputStream()); |
54 |
|
DataReader data = new DataReader(inBound); |
55 |
|
|
56 |
< |
SwingClient cli = new SwingClient(data); |
57 |
< |
Thread cliThread = new Thread(cli); |
58 |
< |
cliThread.start(); |
56 |
> |
SwingClient client = new SwingClient(data); |
57 |
> |
Thread clientThread = new Thread(client); |
58 |
> |
clientThread.start(); |
59 |
|
} catch (Exception e) { |
60 |
|
System.err.println("ERROR START: " + e); |
61 |
+ |
System.exit(1); |
62 |
|
} |
63 |
|
} |
64 |
|
|
84 |
|
header.add(Box.createHorizontalGlue()); |
85 |
|
header.add(iscream); |
86 |
|
|
76 |
– |
|
77 |
– |
|
87 |
|
//_tabbedPane.setSelectedIndex(0); |
88 |
|
|
89 |
|
// build the frame |
156 |
|
//---ACCESSOR/MUTATOR METHODS--- |
157 |
|
|
158 |
|
//---ATTRIBUTES--- |
159 |
+ |
|
160 |
|
HostDisplayPanel host; |
161 |
|
JTabbedPane _tabbedPane = new JTabbedPane(); |
152 |
– |
|
153 |
– |
JLabel _machine_name = new JLabel(); |
154 |
– |
JLabel _ip = new JLabel(); |
155 |
– |
JLabel _date = new JLabel(); |
156 |
– |
JLabel _seq_no = new JLabel(); |
157 |
– |
|
158 |
– |
JLabel _sTime = new JLabel(); |
159 |
– |
|
160 |
– |
JLabel _load_load1 = new JLabel(); |
161 |
– |
JLabel _load_load5 = new JLabel(); |
162 |
– |
JLabel _load_load15 = new JLabel(); |
163 |
– |
|
164 |
– |
JLabel _processes_total = new JLabel(); |
165 |
– |
JLabel _processes_sleeping = new JLabel(); |
166 |
– |
JLabel _processes_zombie = new JLabel(); |
167 |
– |
JLabel _processes_stopped = new JLabel(); |
168 |
– |
|
169 |
– |
int min = 0; |
170 |
– |
int max = 100; |
171 |
– |
JProgressBar _cpu_idle = new JProgressBar(JProgressBar.HORIZONTAL, min, max); |
172 |
– |
{ |
173 |
– |
_cpu_idle.setStringPainted(true); |
174 |
– |
} |
175 |
– |
JProgressBar _cpu_user = new JProgressBar(JProgressBar.HORIZONTAL, min, max); |
176 |
– |
{ |
177 |
– |
_cpu_user.setStringPainted(true); |
178 |
– |
} |
179 |
– |
JProgressBar _cpu_kernel = new JProgressBar(JProgressBar.HORIZONTAL, min, max); |
180 |
– |
{ |
181 |
– |
_cpu_kernel.setStringPainted(true); |
182 |
– |
} |
183 |
– |
JProgressBar _cpu_iowait = new JProgressBar(JProgressBar.HORIZONTAL, min, max); |
184 |
– |
{ |
185 |
– |
_cpu_iowait.setStringPainted(true); |
186 |
– |
} |
187 |
– |
JProgressBar _cpu_swap = new JProgressBar(JProgressBar.HORIZONTAL, min, max); |
188 |
– |
{ |
189 |
– |
_cpu_swap.setStringPainted(true); |
190 |
– |
} |
191 |
– |
|
192 |
– |
JLabel _memory_real = new JLabel(); |
193 |
– |
JLabel _memory_free = new JLabel(); |
194 |
– |
JLabel _memory_swapinuse = new JLabel(); |
195 |
– |
JLabel _memory_swapfree = new JLabel(); |
162 |
|
DataReader _data; |
163 |
|
JLabel _status = new JLabel(); |
164 |
|
ImageIcon _serverIcon = new ImageIcon("server.gif"); |