diff --git a/app/src/processing/app/AbstractMonitor.java b/app/src/processing/app/AbstractMonitor.java index 42c095aad13..b6ba0d7652e 100644 --- a/app/src/processing/app/AbstractMonitor.java +++ b/app/src/processing/app/AbstractMonitor.java @@ -1,7 +1,6 @@ package processing.app; import cc.arduino.packages.BoardPort; -import cc.arduino.packages.DiscoveryManager; import processing.app.legacy.PApplet; import javax.swing.*; @@ -10,7 +9,6 @@ import java.awt.event.ActionListener; import java.awt.event.WindowAdapter; import java.awt.event.WindowEvent; -import java.util.List; @SuppressWarnings("serial") public abstract class AbstractMonitor extends JFrame implements ActionListener { @@ -85,7 +83,7 @@ public void actionPerformed(ActionEvent ae) { suspend(); } } else { - if (closed && (Editor.isUploading() == false)) { + if (closed && !Editor.isUploading()) { resume(boardPort); } } diff --git a/app/src/processing/app/AbstractTextMonitor.java b/app/src/processing/app/AbstractTextMonitor.java index 4e35d4e448f..d6d256b1c70 100644 --- a/app/src/processing/app/AbstractTextMonitor.java +++ b/app/src/processing/app/AbstractTextMonitor.java @@ -3,6 +3,7 @@ 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,25 @@ public void windowGainedFocus(WindowEvent e) { } @Override - protected void onEnableWindow(boolean enable) - { - textArea.setEnabled(enable); + protected void onEnableWindow(boolean 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); diff --git a/app/src/processing/app/SerialMonitor.java b/app/src/processing/app/SerialMonitor.java index 435f19956c3..9af95d8d4cd 100644 --- a/app/src/processing/app/SerialMonitor.java +++ b/app/src/processing/app/SerialMonitor.java @@ -23,7 +23,6 @@ import java.awt.Color; import java.awt.event.ActionEvent; -import java.awt.event.ActionListener; import java.awt.event.KeyAdapter; import java.awt.event.KeyEvent; @@ -143,7 +142,6 @@ public void close() throws Exception { int[] location = getPlacement(); String locationStr = PApplet.join(PApplet.str(location), ","); PreferencesData.set("last.serial.location", locationStr); - textArea.setText(""); serial.dispose(); serial = null; }