Skip to content

Commit 250bce0

Browse files
committed
Adding keyboard shortcut (command or ctrl w) for closing the serial monitor window.
1 parent 672ad56 commit 250bce0

2 files changed

Lines changed: 9 additions & 2 deletions

File tree

app/src/processing/app/SerialMonitor.java

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,15 @@ public void windowClosing(WindowEvent e) {
4646
closeSerialPort();
4747
}
4848
});
49+
50+
// obvious, no?
51+
KeyStroke wc = Editor.WINDOW_CLOSE_KEYSTROKE;
52+
getRootPane().getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT).put(wc, "close");
53+
getRootPane().getActionMap().put("close", new AbstractAction() {
54+
public void actionPerformed(ActionEvent e) {
55+
closeSerialPort();
56+
setVisible(false);
57+
}});
4958

5059
getContentPane().setLayout(new BorderLayout());
5160

todo.txt

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,6 @@
33

44
PROCESSING 5503 SYNC
55

6-
Don't require save before upload.
7-
86
Add library keyword highlighting.
97

108
Allow closing of the serial monitor with keyboard short cuts.

0 commit comments

Comments
 (0)