Skip to content

Add "Clear" button to Serial Monitor UI. #5849

Closed
@rlaferla

Description

@rlaferla

Many times, your Arduino is spitting out a ton of data and you want to manually clear the monitor. The only way currently (AFAIK) is to restart the app. I'd like to see a "Clear" button on the GUI that when pressed clears the monitor.

I looked at the code and this could be easily added to SerialMonitor and AbstractTextMonitor with some code similar to below:

protected JButton clearButton;

protected void onCreateWindow(Container mainPane) {
  // after adding send button
  clearButton = new JButton(tr("Clear"));
  upperPane.add(clearButton);
}

  public void onClearCommand(ActionListener listener) {
    clearButton.addActionListener(listener);
  }

protected void onEnableWindow(boolean enable) {
  // other code
    clearButton.setEnabled(enable);
}

// and in Serial Monitor.java

    onClearCommand(new ActionListener() {
          public void actionPerformed(ActionEvent e) {
              textArea.setText("");
          }
    });

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions