[sikuli] 269/385: IDE: PatternWindow. Added actions on ESCAPE and X-button
Gilles Filippini
pini at moszumanska.debian.org
Sun Jun 29 19:26:22 UTC 2014
This is an automated email from the git hooks/post-receive script.
pini pushed a commit to tag upstream/1.1.0_beta1
in repository sikuli.
commit 7b3aab50711bf5e55c65bab43b338b05dc1db5ac
Author: rssdev10 <rssdev10 at gmail.com>
Date: Sun Feb 23 17:34:47 2014 +0400
IDE: PatternWindow. Added actions on ESCAPE and X-button
---
IDE/src/main/java/org/sikuli/ide/PatternWindow.java | 18 +++++++++++++++++-
1 file changed, 17 insertions(+), 1 deletion(-)
diff --git a/IDE/src/main/java/org/sikuli/ide/PatternWindow.java b/IDE/src/main/java/org/sikuli/ide/PatternWindow.java
index 0cc8622..e952116 100755
--- a/IDE/src/main/java/org/sikuli/ide/PatternWindow.java
+++ b/IDE/src/main/java/org/sikuli/ide/PatternWindow.java
@@ -128,7 +128,7 @@ public class PatternWindow extends JFrame {
btnOK.addActionListener(new ActionOK(this));
JButton btnApply = new JButton(_I("apply"));
btnApply.addActionListener(new ActionApply(this));
- JButton btnCancel = new JButton(_I("cancel"));
+ final JButton btnCancel = new JButton(_I("cancel"));
btnCancel.addActionListener(new ActionCancel(this));
GridBagConstraints c = new GridBagConstraints();
c.gridy = 3;
@@ -140,6 +140,22 @@ public class PatternWindow extends JFrame {
pane.add(btnApply, c);
c.gridx = 2;
pane.add(btnCancel, c);
+ this.addWindowListener(new WindowAdapter() {
+ public void windowClosing(WindowEvent we) {
+ btnCancel.doClick();
+ }
+ });
+ KeyStroke escapeKeyStroke =
+ KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0, false);
+ this.getRootPane().
+ getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).
+ put(escapeKeyStroke, "ESCAPE");
+ this.getRootPane().getActionMap().put("ESCAPE",
+ new AbstractAction() {
+ public void actionPerformed(ActionEvent e) {
+ btnCancel.doClick();
+ }
+ });
return pane;
}
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-java/sikuli.git
More information about the pkg-java-commits
mailing list