File tree 1 file changed +7
-0
lines changed
1 file changed +7
-0
lines changed Original file line number Diff line number Diff line change @@ -37,6 +37,7 @@ public class SerialPlotter extends AbstractMonitor {
37
37
38
38
private final StringBuffer messageBuffer ;
39
39
private JComboBox <String > serialRates ;
40
+ private JButton clearButton ;
40
41
private Serial serial ;
41
42
private int serialRate , xCount ;
42
43
@@ -231,6 +232,8 @@ public SerialPlotter(BoardPort port) {
231
232
232
233
messageBuffer = new StringBuffer ();
233
234
graphs = new ArrayList <>();
235
+
236
+ clearButton .addActionListener (ae -> {graphs .clear ();});
234
237
}
235
238
236
239
protected void onCreateWindow (Container mainPane ) {
@@ -248,16 +251,20 @@ protected void onCreateWindow(Container mainPane) {
248
251
for (String serialRateString : serialRateStrings ) serialRates .addItem (serialRateString + " " + tr ("baud" ));
249
252
250
253
serialRates .setMaximumSize (serialRates .getMinimumSize ());
254
+
255
+ clearButton = new JButton (tr ("Clear output" ));
251
256
252
257
pane .add (Box .createHorizontalGlue ());
253
258
pane .add (Box .createRigidArea (new Dimension (8 , 0 )));
254
259
pane .add (serialRates );
260
+ pane .add (clearButton );
255
261
256
262
mainPane .add (pane , BorderLayout .SOUTH );
257
263
}
258
264
259
265
protected void onEnableWindow (boolean enable ) {
260
266
serialRates .setEnabled (enable );
267
+ clearButton .setEnabled (enable );
261
268
}
262
269
263
270
private void onSerialRateChange (ActionListener listener ) {
You can’t perform that action at this time.
0 commit comments