mirror of
https://github.com/arduino/Arduino.git
synced 2024-12-01 12:24:14 +01:00
Adding keyboard shortcut (command or ctrl w) for closing the serial monitor window.
This commit is contained in:
parent
672ad5648e
commit
250bce0f34
@ -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());
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user