changeset 32:6cbb34600e38

TabEdit: Cancel and save keyboard shortcuts
author Fox
date Wed, 11 May 2022 02:32:44 +0200
parents fb49a356458a
children 2c1f4dc0513f
files src/junotu/TabEdit.java
diffstat 1 files changed, 29 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/src/junotu/TabEdit.java	Wed May 11 01:33:40 2022 +0200
+++ b/src/junotu/TabEdit.java	Wed May 11 02:32:44 2022 +0200
@@ -4,9 +4,12 @@
 import java.awt.Font;
 import java.awt.event.ActionEvent;
 import java.awt.event.ActionListener;
+import java.awt.event.InputEvent;
+import java.awt.event.KeyEvent;
 import java.awt.event.FocusEvent;
 import java.awt.event.FocusListener;
 
+import javax.swing.KeyStroke;
 import javax.swing.SwingUtilities;
 import javax.swing.event.DocumentListener;
 import javax.swing.event.DocumentEvent;
@@ -205,6 +208,32 @@
 						    }
 						}
 						);
+
+	registerKeyboardAction(
+			       new ActionListener() {
+				   @Override
+				   public void actionPerformed( ActionEvent e )
+				   {
+				       buttonClickedBack();
+				   }
+			       },
+			       null,
+			       KeyStroke.getKeyStroke( KeyEvent.VK_ESCAPE, 0 ),
+			       WHEN_IN_FOCUSED_WINDOW
+			       );
+	
+	registerKeyboardAction(
+			       new ActionListener() {
+				   @Override
+				   public void actionPerformed( ActionEvent e )
+				   {
+				       buttonClickedSave( true );
+				   }
+			       },
+			       null,
+			       KeyStroke.getKeyStroke( KeyEvent.VK_S, InputEvent.CTRL_DOWN_MASK ),
+			       WHEN_IN_FOCUSED_WINDOW
+			       );
 	
     }