1 |
|
//---PACKAGE DECLARATION--- |
2 |
< |
package uk.ac.ukc.iscream.conient; |
2 |
> |
package uk.org.iscream.conient; |
3 |
|
|
4 |
|
//---IMPORTS--- |
5 |
< |
import uk.ac.ukc.iscream.util.*; |
5 |
> |
import uk.org.iscream.util.*; |
6 |
|
import javax.swing.*; |
7 |
|
import java.awt.BorderLayout; |
8 |
+ |
import java.net.URL; |
9 |
|
import java.awt.event.ActionListener; |
10 |
|
import java.awt.event.ActionEvent; |
11 |
|
|
54 |
|
* to dispatch events to the ConnectionHandler |
55 |
|
*/ |
56 |
|
private JToolBar setupToolBar() { |
56 |
– |
JButton connectButton = new JButton("Connect", new ImageIcon("./uk/ac/ukc/iscream/conient/control16.gif")); |
57 |
– |
connectButton.addActionListener(connectListener); |
58 |
– |
JButton disconnectButton = new JButton("Disconnect", new ImageIcon("./uk/ac/ukc/iscream/conient/stop16.gif")); |
59 |
– |
disconnectButton.addActionListener(disconnectListener); |
57 |
|
|
58 |
< |
JButton startDataButton = new JButton("Start Data", new ImageIcon("./uk/ac/ukc/iscream/conient/data16.gif")); |
59 |
< |
startDataButton.addActionListener(startDataListener); |
60 |
< |
JButton stopDataButton = new JButton("Stop Data", new ImageIcon("./uk/ac/ukc/iscream/conient/stop16.gif")); |
61 |
< |
stopDataButton.addActionListener(stopDataListener); |
58 |
> |
JButton connectButton = new JButton("Connect", new ImageIcon("./resources/control16.gif")); |
59 |
> |
connectButton.addActionListener(new ActionListener() { |
60 |
> |
public void actionPerformed(ActionEvent e) { |
61 |
> |
_actionQueue.add(new Integer(ConnectionHandler.CONNECT)); |
62 |
> |
} |
63 |
> |
}); |
64 |
> |
JButton disconnectButton = new JButton("Disconnect", new ImageIcon("./resources/stop16.gif")); |
65 |
> |
disconnectButton.addActionListener(new ActionListener() { |
66 |
> |
public void actionPerformed(ActionEvent e) { |
67 |
> |
_actionQueue.add(new Integer(ConnectionHandler.DISCONNECT)); |
68 |
> |
} |
69 |
> |
}); |
70 |
|
|
71 |
+ |
JButton startDataButton = new JButton("Start Data", new ImageIcon("./resources/data16.gif")); |
72 |
+ |
startDataButton.addActionListener(new ActionListener() { |
73 |
+ |
public void actionPerformed(ActionEvent e) { |
74 |
+ |
_actionQueue.add(new Integer(ConnectionHandler.STARTDATA)); |
75 |
+ |
} |
76 |
+ |
}); |
77 |
+ |
JButton stopDataButton = new JButton("Stop Data", new ImageIcon("./resources/stop16.gif")); |
78 |
+ |
stopDataButton.addActionListener(new ActionListener() { |
79 |
+ |
public void actionPerformed(ActionEvent e) { |
80 |
+ |
_actionQueue.add(new Integer(ConnectionHandler.STOPDATA)); |
81 |
+ |
} |
82 |
+ |
}); |
83 |
+ |
|
84 |
|
JToolBar bar = new JToolBar(JToolBar.HORIZONTAL); |
85 |
|
bar.add(connectButton); |
86 |
|
bar.add(disconnectButton); |
89 |
|
bar.add(stopDataButton); |
90 |
|
|
91 |
|
bar.add(Box.createGlue()); |
92 |
< |
JLabel image = new JLabel(new ImageIcon("./uk/ac/ukc/iscream/conient/i-scream.gif")); |
92 |
> |
JLabel image = new JLabel(new ImageIcon("./resources/i-scream.gif")); |
93 |
|
bar.add(image); |
94 |
|
return bar; |
95 |
|
} |
152 |
|
bar.add(conientMenu); |
153 |
|
|
154 |
|
JMenu connectionMenu = new JMenu("Connection"); |
155 |
< |
JMenuItem controlConnect = new JMenuItem("Connect", new ImageIcon("./uk/ac/ukc/iscream/conient/control16.gif")); |
156 |
< |
controlConnect.addActionListener(connectListener); |
155 |
> |
JMenuItem controlConnect = new JMenuItem("Connect", new ImageIcon("./resources/control16.gif")); |
156 |
> |
controlConnect.addActionListener(new ActionListener() { |
157 |
> |
public void actionPerformed(ActionEvent e) { |
158 |
> |
_actionQueue.add(new Integer(ConnectionHandler.CONNECT)); |
159 |
> |
} |
160 |
> |
}); |
161 |
|
connectionMenu.add(controlConnect); |
162 |
< |
JMenuItem controlDisconnect = new JMenuItem("Disconnect", new ImageIcon("./uk/ac/ukc/iscream/conient/stop16.gif")); |
163 |
< |
controlDisconnect.addActionListener(disconnectListener); |
162 |
> |
JMenuItem controlDisconnect = new JMenuItem("Disconnect", new ImageIcon("./resources/stop16.gif")); |
163 |
> |
controlDisconnect.addActionListener(new ActionListener() { |
164 |
> |
public void actionPerformed(ActionEvent e) { |
165 |
> |
_actionQueue.add(new Integer(ConnectionHandler.DISCONNECT)); |
166 |
> |
} |
167 |
> |
}); |
168 |
|
connectionMenu.add(controlDisconnect); |
169 |
|
connectionMenu.addSeparator(); |
170 |
< |
JMenuItem dataConnect = new JMenuItem("Start Data", new ImageIcon("./uk/ac/ukc/iscream/conient/data16.gif")); |
171 |
< |
dataConnect.addActionListener(startDataListener); |
170 |
> |
JMenuItem dataConnect = new JMenuItem("Start Data", new ImageIcon("./resources/data16.gif")); |
171 |
> |
dataConnect.addActionListener(new ActionListener() { |
172 |
> |
public void actionPerformed(ActionEvent e) { |
173 |
> |
_actionQueue.add(new Integer(ConnectionHandler.STARTDATA)); |
174 |
> |
} |
175 |
> |
}); |
176 |
|
connectionMenu.add(dataConnect); |
177 |
< |
JMenuItem dataDisconnect = new JMenuItem("Stop Data", new ImageIcon("./uk/ac/ukc/iscream/conient/stop16.gif")); |
178 |
< |
dataDisconnect.addActionListener(stopDataListener); |
177 |
> |
JMenuItem dataDisconnect = new JMenuItem("Stop Data", new ImageIcon("./resources/stop16.gif")); |
178 |
> |
dataDisconnect.addActionListener(new ActionListener() { |
179 |
> |
public void actionPerformed(ActionEvent e) { |
180 |
> |
_actionQueue.add(new Integer(ConnectionHandler.STOPDATA)); |
181 |
> |
} |
182 |
> |
}); |
183 |
|
connectionMenu.add(dataDisconnect); |
184 |
|
bar.add(connectionMenu); |
185 |
< |
|
152 |
< |
JMenu helpMenu = new JMenu("Help"); |
153 |
< |
JMenuItem help = new JMenuItem("Help"); |
154 |
< |
helpMenu.add(help); |
155 |
< |
JMenuItem about = new JMenuItem("About"); |
156 |
< |
helpMenu.add(about); |
157 |
< |
bar.add(helpMenu); |
158 |
< |
|
185 |
> |
|
186 |
|
return bar; |
187 |
|
} |
188 |
|
|
199 |
|
*/ |
200 |
|
JToolBar _toolBar = setupToolBar(); |
201 |
|
|
202 |
+ |
/** |
203 |
+ |
* The menu bar for the Frame |
204 |
+ |
*/ |
205 |
|
JMenuBar _menuBar = setupMenuBar(); |
206 |
|
|
207 |
|
/** |
213 |
|
* The connection handler in use by the system. |
214 |
|
*/ |
215 |
|
ConnectionHandler _handler; |
186 |
– |
|
187 |
– |
ActionListener connectListener = new ActionListener() |
188 |
– |
{ |
189 |
– |
public void actionPerformed(ActionEvent e) { |
190 |
– |
_actionQueue.add(new Integer(ConnectionHandler.CONNECT)); |
191 |
– |
} |
192 |
– |
}; |
193 |
– |
|
194 |
– |
|
195 |
– |
ActionListener startDataListener = new ActionListener() |
196 |
– |
{ |
197 |
– |
public void actionPerformed(ActionEvent e) { |
198 |
– |
_actionQueue.add(new Integer(ConnectionHandler.STARTDATA)); |
199 |
– |
} |
200 |
– |
}; |
201 |
– |
ActionListener stopDataListener = new ActionListener() |
202 |
– |
{ |
203 |
– |
public void actionPerformed(ActionEvent e) { |
204 |
– |
_actionQueue.add(new Integer(ConnectionHandler.STOPDATA)); |
205 |
– |
} |
206 |
– |
}; |
207 |
– |
|
208 |
– |
ActionListener disconnectListener = new ActionListener() |
209 |
– |
{ |
210 |
– |
public void actionPerformed(ActionEvent e) { |
211 |
– |
_actionQueue.add(new Integer(ConnectionHandler.DISCONNECT)); |
212 |
– |
} |
213 |
– |
}; |
216 |
|
|
217 |
|
//---STATIC ATTRIBUTES--- |
218 |
|
|