|
From: SVN by r. <sv...@ca...> - 2008-10-15 15:08:15
|
Author: rotman
Date: 2008-10-15 17:06:52 +0200 (Wed, 15 Oct 2008)
New Revision: 324
Modified:
src/main/java/nl/improved/sqlclient/charva/CharvaSQLShellWindow.java
Log:
* Style fix for static field
* Attempt to make the popup disapear again on ESC
Modified: src/main/java/nl/improved/sqlclient/charva/CharvaSQLShellWindow.java
===================================================================
--- src/main/java/nl/improved/sqlclient/charva/CharvaSQLShellWindow.java 2008-10-15 07:52:40 UTC (rev 323)
+++ src/main/java/nl/improved/sqlclient/charva/CharvaSQLShellWindow.java 2008-10-15 15:06:52 UTC (rev 324)
@@ -167,7 +167,7 @@
return;
}
if (evt.isActionKey()) {
- if (evt.getKeyCode() == evt.VK_ENTER) {
+ if (evt.getKeyCode() == KeyEvent.VK_ENTER) {
handleInput(new InputKey('\n'));
evt.consume();
} else if (evt.getKeyCode() == KeyEvent.VK_BACK_SPACE) {
@@ -200,7 +200,7 @@
} else if (evt.getKeyCode() == KeyEvent.VK_END) {
handleInput(new InputKey(InputKey.SpecialKey.END));
evt.consume();
- }
+ }
return;
}
handleInput(new InputKey((char)evt.getKeyCode()));
@@ -250,7 +250,24 @@
}
}
+ @Override
+ public void processKeyEvent(KeyEvent evt) {
+ super.processKeyEvent(evt);
+ /*
+ * SR: Ok, so I am aware that all this logic should have been placed in a KeyListener instead...
+ * For some dark reason though it seems that if I add a keyListener to either this popup or the
+ * menuitems individually, the listener never gets the desired key events.
+ */
+ if (evt.isConsumed()) {
+ return;
+ }
+ if (evt.getKeyCode() == KeyEvent.VK_ESCAPE) {
+ MyPopupMenu.super.hide();
+ evt.consume();
+ }
+ }
+
@Override
public void hide() {}
|