mirror of
https://github.com/esp8266/Arduino.git
synced 2025-06-16 11:21:18 +03:00
Add clear button to the serial monitor
This commit is contained in:
@ -42,6 +42,7 @@ public abstract class AbstractMonitor extends JFrame implements ActionListener {
|
||||
protected JScrollPane scrollPane;
|
||||
protected JTextField textField;
|
||||
protected JButton sendButton;
|
||||
protected JButton clearButton;
|
||||
protected JCheckBox autoscrollBox;
|
||||
protected JComboBox lineEndings;
|
||||
protected JComboBox serialRates;
|
||||
@ -148,6 +149,13 @@ public abstract class AbstractMonitor extends JFrame implements ActionListener {
|
||||
}
|
||||
|
||||
serialRates.setMaximumSize(serialRates.getMinimumSize());
|
||||
|
||||
clearButton = new JButton(_("Clear"));
|
||||
clearButton.addActionListener(new ActionListener() {
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
textArea.setText("");
|
||||
}
|
||||
});
|
||||
|
||||
pane.add(autoscrollBox);
|
||||
pane.add(Box.createHorizontalGlue());
|
||||
@ -156,6 +164,8 @@ public abstract class AbstractMonitor extends JFrame implements ActionListener {
|
||||
pane.add(lineEndings);
|
||||
pane.add(Box.createRigidArea(new Dimension(8, 0)));
|
||||
pane.add(serialRates);
|
||||
pane.add(Box.createRigidArea(new Dimension(8, 0)));
|
||||
pane.add(clearButton);
|
||||
|
||||
this.setMinimumSize(new Dimension(pane.getMinimumSize().width, this.getPreferredSize().height));
|
||||
|
||||
@ -194,6 +204,7 @@ public abstract class AbstractMonitor extends JFrame implements ActionListener {
|
||||
autoscrollBox.setEnabled(enable);
|
||||
lineEndings.setEnabled(enable);
|
||||
serialRates.setEnabled(enable);
|
||||
clearButton.setEnabled(enable);
|
||||
|
||||
monitorEnabled = enable;
|
||||
}
|
||||
|
Reference in New Issue
Block a user