changeset 3616:c7e368a95c75

7016942: Revert a refactoring in TooltipManager to allow reflection hack Reviewed-by: rupashka
author alexp
date Mon, 07 Feb 2011 21:15:51 +0300
parents 0fae79ec7248
children 989f6d3eee0d
files src/share/classes/javax/swing/ToolTipManager.java
diffstat 1 files changed, 9 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/src/share/classes/javax/swing/ToolTipManager.java	Thu Feb 03 09:59:20 2011 -0800
+++ b/src/share/classes/javax/swing/ToolTipManager.java	Mon Feb 07 21:15:51 2011 +0300
@@ -75,6 +75,9 @@
     private MouseMotionListener moveBeforeEnterListener = null;
     private KeyListener accessibilityKeyListener = null;
 
+    private KeyStroke postTip;
+    private KeyStroke hideTip;
+
     // PENDING(ges)
     protected boolean lightWeightPopupEnabled = true;
     protected boolean heavyWeightPopupEnabled = false;
@@ -89,6 +92,9 @@
 
         moveBeforeEnterListener = new MoveBeforeEnterListener();
         accessibilityKeyListener = new AccessibilityKeyListener();
+
+        postTip = KeyStroke.getKeyStroke(KeyEvent.VK_F1, InputEvent.CTRL_MASK);
+        hideTip =  KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0);
     }
 
     /**
@@ -805,13 +811,13 @@
         public void keyPressed(KeyEvent e) {
             if (!e.isConsumed()) {
                 JComponent source = (JComponent) e.getComponent();
-                if (e.getKeyCode() == KeyEvent.VK_ESCAPE) {
+                KeyStroke keyStrokeForEvent = KeyStroke.getKeyStrokeForEvent(e);
+                if (hideTip.equals(keyStrokeForEvent)) {
                     if (tipWindow != null) {
                         hide(source);
                         e.consume();
                     }
-                } else if (e.getKeyCode() == KeyEvent.VK_F1
-                        && e.getModifiers() == Event.CTRL_MASK) {
+                } else if (postTip.equals(keyStrokeForEvent)) {
                     // Shown tooltip will be hidden
                     ToolTipManager.this.show(source);
                     e.consume();