Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8050223

Documentation/ coding missmatch on javax.swing.InputMap::put Method

XMLWordPrintable

      FULL PRODUCT VERSION :
      java 1.7.0_11 (Oracle Corporation; 1.7.0_11-b21; /opt/javadev/jdk1.7.0_11/jre)


      ADDITIONAL OS VERSION INFORMATION :
      Linux coin 3.7.7-1-ARCH #1 SMP PREEMPT Mon Feb 11 20:20:58 EET 2013 x86_64 GNU/Linux


      A DESCRIPTION OF THE PROBLEM :
      in the documentation for the avax.swing.InputMap::put Method it is stated: " If actionMapKey is null, this removes the current binding for keyStroke. " . this is incorrect/not working. According to " http://docs.oracle.com/javase/tutorial/uiswing/misc/keybinding.html#howto " you have to set the actionMapKey to " none " for removing the action processing. This seems to work as desired.

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      (create a JSlider)

      InputMap im = slider.getInputMap();

      im.put(KeyStroke.getKeyStroke(KeyEvent.VK_UP, 0), null); // <- not working, UP acion will be working
      // im.put(KeyStroke.getKeyStroke(KeyEvent.VK_UP, 0), " none " ); // <. correct


      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      default " UP " action should not be called.
      ACTUAL -
      default " UP " action will be called.

      REPRODUCIBILITY :
      This bug can be reproduced always.

      ---------- BEGIN SOURCE ----------
      <none>
      ---------- END SOURCE ----------

      CUSTOMER SUBMITTED WORKAROUND :
      no workaround since the correct way is available but hard to find.

            psadhukhan Prasanta Sadhukhan
            webbuggrp Webbug Group
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: