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

RFE: JFormattedTextField should allow null value/empty text

XMLWordPrintable



      Name: jk109818 Date: 09/10/2002


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

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

      A DESCRIPTION OF THE PROBLEM :
      I am using a JFormattedTextField. I created it with the
      default ctr, set the number of columns, and called
      setValue() with a Date object.

      If I tab to the field, clear the text, and tab out, the text
      goes back to the previous value.

      It would be nice if there was suppor for calling
      setValue(null) which would set the field to the empty string
      and calling getValue() with the field blank and return null.

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      1. Create a dialog with a JFormattedTextField
      2. Create field with default ctr
      3. Call setValue(new Date());
      4. Show dialog
      5. Tab to field
      6. Clear value
      7. Tab out of field and value reverts back

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      I want to leave the field with the default COMMIT_OR_REVERT
      setting so if the user enters truly invalid data, then the
      current behavior is good. I just would like support for
      empty fields / null objects.

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

            peterz Peter Zhelezniakov
            jkimsunw Jeffrey Kim (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Imported:
              Indexed: