This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 241397 - JFormattedTextField - restore default value
Summary: JFormattedTextField - restore default value
Status: NEW
Alias: None
Product: guibuilder
Classification: Unclassified
Component: Code (show other bugs)
Version: 7.4
Hardware: PC Mac OS X
: P3 normal with 1 vote (vote)
Assignee: issues@guibuilder
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-02-04 15:29 UTC by aeps
Modified: 2014-02-04 18:06 UTC (History)
0 users

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description aeps 2014-02-04 15:29:22 UTC
Place a JFormattedTextField on a JPanel, add a mask. NB creates this code:

    try {
      jFormattedTextField1.setFormatterFactory(new javax.swing.text.DefaultFormatterFactory(new javax.swing.text.MaskFormatter("###-####")));
    } catch (java.text.ParseException ex) {
      ex.printStackTrace();
    }

After that, right click on the formatterFactory an press restore default value. NB leaves the following code:

    try {
    } catch (java.text.ParseException ex) {
      ex.printStackTrace();
    }

in the private void initComponents(), that can not be edited. So you have to open the file in a Texteditor and delete this code.
Comment 1 Tomas Pavek 2014-02-04 18:06:46 UTC
Workaround is to change the format (formatterFactory) to something else than mask first (that will remove the try/catch code), then restore default value.