1
0
mirror of https://github.com/arduino/Arduino.git synced 2025-02-20 14:54:31 +01:00

Do not clear serial monitor when disabled for upload (@PaulStoffregen)

Fix #9234
This commit is contained in:
Cristian Maglie 2020-01-20 17:04:04 +01:00 committed by Cristian Maglie
parent 00641691b6
commit 7ae377d3e9
2 changed files with 22 additions and 4 deletions

View File

@ -3,6 +3,7 @@ package processing.app;
import static processing.app.I18n.tr;
import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Container;
import java.awt.Dimension;
import java.awt.Font;
@ -170,9 +171,27 @@ public abstract class AbstractTextMonitor extends AbstractMonitor {
}
@Override
protected void onEnableWindow(boolean enable)
{
textArea.setEnabled(enable);
protected void onEnableWindow(boolean enable) {
Thread.dumpStack();
System.out.println("onEnableWindow " + enable);
// never actually disable textArea, so people can
// still select & copy text, even when the port
// is closed or disconnected
textArea.setEnabled(true);
if (enable) {
// setting these to null for system default
// gives a wrong gray background on Windows
// so assume black text on white background
textArea.setForeground(Color.BLACK);
textArea.setBackground(Color.WHITE);
} else {
// In theory, UIManager.getDefaults() should
// give us the system's colors for disabled
// windows. But it doesn't seem to work. :(
textArea.setForeground(new Color(64, 64, 64));
textArea.setBackground(new Color(238, 238, 238));
}
textArea.invalidate();
clearButton.setEnabled(enable);
scrollPane.setEnabled(enable);
textField.setEnabled(enable);

View File

@ -142,7 +142,6 @@ public class SerialMonitor extends AbstractTextMonitor {
int[] location = getPlacement();
String locationStr = PApplet.join(PApplet.str(location), ",");
PreferencesData.set("last.serial.location", locationStr);
textArea.setText("");
serial.dispose();
serial = null;
}