Skip to content

Commit 4d6385a

Browse files
committed
Serial monitor: input textfield is automatically selected
When the serial monitor window is focused again (not reopened but put in background and selected again) the text input field is now automatically focused. Fix arduino#5810
1 parent e9e24bd commit 4d6385a

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

app/src/processing/app/AbstractTextMonitor.java

+9
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88
import java.awt.Font;
99
import java.awt.event.ActionEvent;
1010
import java.awt.event.ActionListener;
11+
import java.awt.event.WindowAdapter;
12+
import java.awt.event.WindowEvent;
1113

1214
import javax.swing.Box;
1315
import javax.swing.BoxLayout;
@@ -66,6 +68,13 @@ protected void onCreateWindow(Container mainPane) {
6668
upperPane.setBorder(new EmptyBorder(4, 4, 4, 4));
6769

6870
textField = new JTextField(40);
71+
// textField is selected every time the window is focused
72+
addWindowFocusListener(new WindowAdapter() {
73+
public void windowGainedFocus(WindowEvent e) {
74+
textField.requestFocusInWindow();
75+
}
76+
});
77+
6978
sendButton = new JButton(tr("Send"));
7079

7180
upperPane.add(textField);

build/shared/revisions.txt

+1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ ARDUINO 1.8.2
44
* Fix command line: works again with relative paths (regression)
55
* Update arduino-builder to 1.3.24 to avoid name clashing for libraries
66
* Allow BoardManager to fetch FreeBSD tools (thanks @kevans91)
7+
* Serial monitor: the input string box is automatically focused when window is selected
78

89
[core]
910
* Add Atmel-ICE and JTAGICE3 programmers for AVR chips (thanks @matthijskooijman)

0 commit comments

Comments
 (0)