From 250bce0f34d448d567d1bde51a9287777db2f652 Mon Sep 17 00:00:00 2001 From: "David A. Mellis" Date: Tue, 16 Jun 2009 20:21:39 +0000 Subject: [PATCH] Adding keyboard shortcut (command or ctrl w) for closing the serial monitor window. --- app/src/processing/app/SerialMonitor.java | 9 +++++++++ todo.txt | 2 -- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/app/src/processing/app/SerialMonitor.java b/app/src/processing/app/SerialMonitor.java index 99b8c00b0..ddcc4d792 100644 --- a/app/src/processing/app/SerialMonitor.java +++ b/app/src/processing/app/SerialMonitor.java @@ -46,6 +46,15 @@ public class SerialMonitor extends JFrame implements MessageConsumer { closeSerialPort(); } }); + + // obvious, no? + KeyStroke wc = Editor.WINDOW_CLOSE_KEYSTROKE; + getRootPane().getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT).put(wc, "close"); + getRootPane().getActionMap().put("close", new AbstractAction() { + public void actionPerformed(ActionEvent e) { + closeSerialPort(); + setVisible(false); + }}); getContentPane().setLayout(new BorderLayout()); diff --git a/todo.txt b/todo.txt index 7ece71ef3..e0f125c09 100644 --- a/todo.txt +++ b/todo.txt @@ -3,8 +3,6 @@ PROCESSING 5503 SYNC -Don't require save before upload. - Add library keyword highlighting. Allow closing of the serial monitor with keyboard short cuts.