mirror of https://github.com/noisymime/Arduino.git
Serial Monitor: added "clear output" button
This commit is contained in:
parent
bd2f4acba7
commit
99006fc5c6
|
@ -34,6 +34,7 @@ public abstract class AbstractTextMonitor extends AbstractMonitor {
|
||||||
protected JScrollPane scrollPane;
|
protected JScrollPane scrollPane;
|
||||||
protected JTextField textField;
|
protected JTextField textField;
|
||||||
protected JButton sendButton;
|
protected JButton sendButton;
|
||||||
|
protected JButton clearButton;
|
||||||
protected JCheckBox autoscrollBox;
|
protected JCheckBox autoscrollBox;
|
||||||
protected JComboBox lineEndings;
|
protected JComboBox lineEndings;
|
||||||
protected JComboBox serialRates;
|
protected JComboBox serialRates;
|
||||||
|
@ -76,6 +77,7 @@ public abstract class AbstractTextMonitor extends AbstractMonitor {
|
||||||
});
|
});
|
||||||
|
|
||||||
sendButton = new JButton(tr("Send"));
|
sendButton = new JButton(tr("Send"));
|
||||||
|
clearButton = new JButton(tr("Clear output"));
|
||||||
|
|
||||||
upperPane.add(textField);
|
upperPane.add(textField);
|
||||||
upperPane.add(Box.createRigidArea(new Dimension(4, 0)));
|
upperPane.add(Box.createRigidArea(new Dimension(4, 0)));
|
||||||
|
@ -116,6 +118,7 @@ public abstract class AbstractTextMonitor extends AbstractMonitor {
|
||||||
serialRates.setMaximumSize(serialRates.getMinimumSize());
|
serialRates.setMaximumSize(serialRates.getMinimumSize());
|
||||||
|
|
||||||
pane.add(autoscrollBox);
|
pane.add(autoscrollBox);
|
||||||
|
pane.add(clearButton);
|
||||||
pane.add(Box.createHorizontalGlue());
|
pane.add(Box.createHorizontalGlue());
|
||||||
pane.add(noLineEndingAlert);
|
pane.add(noLineEndingAlert);
|
||||||
pane.add(Box.createRigidArea(new Dimension(8, 0)));
|
pane.add(Box.createRigidArea(new Dimension(8, 0)));
|
||||||
|
@ -129,6 +132,7 @@ public abstract class AbstractTextMonitor extends AbstractMonitor {
|
||||||
protected void onEnableWindow(boolean enable)
|
protected void onEnableWindow(boolean enable)
|
||||||
{
|
{
|
||||||
textArea.setEnabled(enable);
|
textArea.setEnabled(enable);
|
||||||
|
clearButton.setEnabled(enable);
|
||||||
scrollPane.setEnabled(enable);
|
scrollPane.setEnabled(enable);
|
||||||
textField.setEnabled(enable);
|
textField.setEnabled(enable);
|
||||||
sendButton.setEnabled(enable);
|
sendButton.setEnabled(enable);
|
||||||
|
@ -142,6 +146,10 @@ public abstract class AbstractTextMonitor extends AbstractMonitor {
|
||||||
sendButton.addActionListener(listener);
|
sendButton.addActionListener(listener);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void onClearCommand(ActionListener listener) {
|
||||||
|
clearButton.addActionListener(listener);
|
||||||
|
}
|
||||||
|
|
||||||
public void onSerialRateChange(ActionListener listener) {
|
public void onSerialRateChange(ActionListener listener) {
|
||||||
serialRates.addActionListener(listener);
|
serialRates.addActionListener(listener);
|
||||||
}
|
}
|
||||||
|
|
|
@ -62,6 +62,12 @@ public class SerialMonitor extends AbstractTextMonitor {
|
||||||
textField.setText("");
|
textField.setText("");
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
onClearCommand(new ActionListener() {
|
||||||
|
public void actionPerformed(ActionEvent e) {
|
||||||
|
textArea.setText("");
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
private void send(String s) {
|
private void send(String s) {
|
||||||
|
|
Loading…
Reference in New Issue