1
1
package processing .app ;
2
2
3
- import java .awt .Container ;
4
- import java .awt .Dimension ;
5
- import java .awt .Rectangle ;
6
- import java .awt .Toolkit ;
3
+ import cc .arduino .packages .BoardPort ;
4
+ import processing .app .legacy .PApplet ;
5
+
6
+ import javax .swing .*;
7
+ import java .awt .*;
7
8
import java .awt .event .ActionEvent ;
8
9
import java .awt .event .ActionListener ;
9
10
import java .awt .event .WindowAdapter ;
10
11
import java .awt .event .WindowEvent ;
11
12
12
- import javax .swing .AbstractAction ;
13
- import javax .swing .JComponent ;
14
- import javax .swing .JFrame ;
15
- import javax .swing .KeyStroke ;
16
- import javax .swing .Timer ;
17
-
18
- import cc .arduino .packages .BoardPort ;
19
- import processing .app .legacy .PApplet ;
20
-
21
13
@ SuppressWarnings ("serial" )
22
14
public abstract class AbstractMonitor extends JFrame implements ActionListener {
23
15
@@ -28,7 +20,7 @@ public abstract class AbstractMonitor extends JFrame implements ActionListener {
28
20
private Timer updateTimer ;
29
21
30
22
private BoardPort boardPort ;
31
-
23
+
32
24
protected String [] serialRateStrings = {"300" , "1200" , "2400" , "4800" , "9600" , "19200" , "38400" , "57600" , "74880" , "115200" , "230400" , "250000" };
33
25
34
26
public AbstractMonitor (BoardPort boardPort ) {
@@ -89,14 +81,14 @@ public void actionPerformed(ActionEvent event) {
89
81
monitorEnabled = true ;
90
82
closed = false ;
91
83
}
92
-
84
+
93
85
protected abstract void onCreateWindow (Container mainPane );
94
86
95
87
public void enableWindow (boolean enable ) {
96
88
onEnableWindow (enable );
97
89
monitorEnabled = enable ;
98
90
}
99
-
91
+
100
92
protected abstract void onEnableWindow (boolean enable );
101
93
102
94
// Puts the window in suspend state, closing the serial port
@@ -181,7 +173,7 @@ private synchronized String consumeUpdateBuffer() {
181
173
updateBuffer .setLength (0 );
182
174
return s ;
183
175
}
184
-
176
+
185
177
public void actionPerformed (ActionEvent e ) {
186
178
String s = consumeUpdateBuffer ();
187
179
if (s .isEmpty ()) {
0 commit comments