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

JFormattedTextField/JSpinner always consumes certain key events

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P4 P4
    • 5.0
    • 1.4.1
    • client-libs
    • tiger
    • x86
    • windows_2000



      Name: jk109818 Date: 09/04/2002


      FULL PRODUCT VERSION :
      java version "1.4.1-rc"
      Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.1-rc-b19)
      Java HotSpot(TM) Client VM (build 1.4.1-rc-b19, mixed mode)


      FULL OPERATING SYSTEM VERSION :Microsoft Windows 2000
      [Version 5.00.2195]


      A DESCRIPTION OF THE PROBLEM :
      JFormattedTextField (and consequently JSpinner) controls
      always consume special key events such as ESC and Enter.
      This means that in an appropriately configured dialog,
      pressing ESC (to cancel the dialog) or Enter (to invoke the
      default action) will not do anything if focus is in a
      JFormattedTextField or JSpinner in the dialog. This is
      particularly awkward if either of these happens to be the
      default focus component in the dialog.

      This is related to bug 4503715 which has been closed. The
      engineer's comment is "Because JFormattedTextField has a
      binding for escape (to cancel the current edit), your
      escape binding will not be processed when the
      JFormattedTextField has focus. Other components bind escape
      as well (a JComboBox does too)". The difference is that ESC
      and Enter are only consumed if the JComboBox is being
      edited and once the combo popup is dismissed, ESC and Enter
      are not consumed. Similarly the JFormattedTextField should
      only consume the key/action event if there are changes to
      be committed or cancelled.


      EXPECTED VERSUS ACTUAL BEHAVIOR :
      If there are no changes to the JFormattedTextField/JSpinner
      to be committed or cancelled then the key/action events
      should not be consumed.


      REPRODUCIBILITY :
      This bug can be reproduced always.
      (Review ID: 163827)
      ======================================================================

            apikalev Andrey Pikalev
            jkimsunw Jeffrey Kim (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: