Revision 404
updated connection mechanism in applet
trunk/code/projects/colonet/ColonetGUI/Colonet.java | ||
---|---|---|
686 | 686 |
// |
687 | 687 |
public void actionPerformed (ActionEvent e) { |
688 | 688 |
Object source = e.getSource(); |
689 |
if (source == btnGraph) { |
|
690 |
btnGraph.setEnabled(false); |
|
691 |
//Start dependent threads |
|
692 |
drawThread = new Thread(this, "drawThread"); |
|
693 |
drawThread.start(); |
|
694 |
indicator.start(); |
|
695 |
simulator.start(); |
|
696 |
webcamLoader.start(); |
|
697 |
} else if (source == btnConnect) { |
|
689 |
if (source == btnConnect) { |
|
690 |
btnConnect.setEnabled(false); |
|
698 | 691 |
csi.connect(txtHost.getText(), txtPort.getText()); |
699 | 692 |
dataUpdater.start(); |
700 | 693 |
drawThread = new Thread(this, "drawThread"); |
... | ... | |
955 | 948 |
String line; |
956 | 949 |
while (true) { |
957 | 950 |
try { |
951 |
//if the socket is closed, make sure we can reconnect |
|
952 |
if (csi.getSocket().isInputShutdown()) |
|
953 |
btnConnect.setEnabled(true); |
|
958 | 954 |
//request more data |
959 | 955 |
if (csi != null && csi.isReady()) { |
960 | 956 |
//csi.sendSensorDataRequest(); |
Also available in: Unified diff