File tree 1 file changed +1
-28
lines changed
1 file changed +1
-28
lines changed Original file line number Diff line number Diff line change 28
28
import javax .swing .border .*;
29
29
import javax .swing .event .*;
30
30
import javax .swing .text .*;
31
- import gnu .io .CommPortIdentifier ;
32
- import java .util .Enumeration ;
33
31
34
- public class SerialMonitor extends JFrame implements MessageConsumer , Runnable {
32
+ public class SerialMonitor extends JFrame implements MessageConsumer {
35
33
private Serial serial ;
36
34
private String port ;
37
35
private JTextArea textArea ;
@@ -173,9 +171,6 @@ public void actionPerformed(ActionEvent event) {
173
171
}
174
172
}
175
173
}
176
-
177
- Thread thread = new Thread (this );
178
- thread .start ();
179
174
}
180
175
181
176
protected void setPlacement (int [] location ) {
@@ -233,26 +228,4 @@ public void run() {
233
228
}
234
229
}});
235
230
}
236
-
237
- public void run () {
238
- while (!Thread .interrupted ()) {
239
- if (serial != null ) {
240
- Enumeration portList = CommPortIdentifier .getPortIdentifiers ();
241
- boolean portStillHere = false ;
242
- while (portList .hasMoreElements ()) {
243
- CommPortIdentifier portId = (CommPortIdentifier ) portList .nextElement ();
244
- if (portId .getName ().equals (port )) {
245
- portStillHere = true ;
246
- }
247
- }
248
- if (!portStillHere ) {
249
- closeSerialPort ();
250
- setVisible (false );
251
- }
252
- try {
253
- Thread .sleep (100 );
254
- } catch (InterruptedException ex ) { }
255
- }
256
- }
257
- }
258
231
}
You can’t perform that action at this time.
0 commit comments