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

Currency format instance does not work with Swing's NumberFormatter

XMLWordPrintable

    • b105
    • generic
    • generic
    • Verified

      The following piece of code won't accept any keyboard input:

              NumberFormat nf = NumberFormat.getCurrencyInstance();
              NumberFormatter nfr = new NumberFormatter(nf);
              nfr.setAllowsInvalid(false);
              nfr.setOverwriteMode(true);
              JFormattedTextField jftf = new JFormattedTextField(nfr);

      This code should allow users to edit currency amounts in the JFormattedTextField. For example in Germany locale, if the user inputs "1000", it should accept it and display "1,000.00 €".

      The similar behavior is observed with a percent format, which is already reported in the bug 6462562.

            peterz Peter Zhelezniakov
            naoto Naoto Sato
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: