|
3 | 3 | import static processing.app.I18n.tr;
|
4 | 4 |
|
5 | 5 | import java.awt.BorderLayout;
|
| 6 | +import java.awt.Color; |
6 | 7 | import java.awt.Container;
|
7 | 8 | import java.awt.Dimension;
|
8 | 9 | import java.awt.Font;
|
@@ -170,9 +171,27 @@ public void windowGainedFocus(WindowEvent e) {
|
170 | 171 | }
|
171 | 172 |
|
172 | 173 | @Override
|
173 |
| - protected void onEnableWindow(boolean enable) |
174 |
| - { |
175 |
| - textArea.setEnabled(enable); |
| 174 | + protected void onEnableWindow(boolean enable) { |
| 175 | + Thread.dumpStack(); |
| 176 | + System.out.println("onEnableWindow " + enable); |
| 177 | + // never actually disable textArea, so people can |
| 178 | + // still select & copy text, even when the port |
| 179 | + // is closed or disconnected |
| 180 | + textArea.setEnabled(true); |
| 181 | + if (enable) { |
| 182 | + // setting these to null for system default |
| 183 | + // gives a wrong gray background on Windows |
| 184 | + // so assume black text on white background |
| 185 | + textArea.setForeground(Color.BLACK); |
| 186 | + textArea.setBackground(Color.WHITE); |
| 187 | + } else { |
| 188 | + // In theory, UIManager.getDefaults() should |
| 189 | + // give us the system's colors for disabled |
| 190 | + // windows. But it doesn't seem to work. :( |
| 191 | + textArea.setForeground(new Color(64, 64, 64)); |
| 192 | + textArea.setBackground(new Color(238, 238, 238)); |
| 193 | + } |
| 194 | + textArea.invalidate(); |
176 | 195 | clearButton.setEnabled(enable);
|
177 | 196 | scrollPane.setEnabled(enable);
|
178 | 197 | textField.setEnabled(enable);
|
|
0 commit comments