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

Summary: JFormattedTextField - restore default value
Product: guibuilder Reporter: aeps <aeps>
Component: CodeAssignee: issues@guibuilder <issues>
Status: NEW ---    
Severity: normal    
Priority: P3    
Version: 7.4   
Hardware: PC   
OS: Mac OS X   
Issue Type: DEFECT Exception Reporter:

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) {

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

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

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.