# HG changeset patch # User alexp # Date 1297102551 -10800 # Node ID b295bba545d36394be816f216e76094835cb9af7 # Parent f1b64e82649fd51f43cf10bd39243eed1efa4ca0 7016942: Revert a refactoring in TooltipManager to allow reflection hack Reviewed-by: rupashka diff -r f1b64e82649f -r b295bba545d3 jdk/src/share/classes/javax/swing/ToolTipManager.java --- a/jdk/src/share/classes/javax/swing/ToolTipManager.java Thu Feb 03 09:59:20 2011 -0800 +++ b/jdk/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();