Allow MaskFormatter To Accept Empty Value In Java

One of the frustrating things in using the MaskFormatter class is that when the JFormattedTextField has an existing value, you cannot replace it with an empty value or set it to null. Wouldn’t it be nice if we could just set a property on the mask formatter to allow this, such as MaskFormatter.setAllowBlankField(true) perhaps?

Luckily, R.J. Lorimer wrote a custom class that inherited the MaskFormatter class to allow empty values to be set. Thank you R.J., your class saved me a great deal of time to create my own custom class! 😉

Related Posts Plugin for WordPress, Blogger...

Leave a Reply

Your email address will not be published. Required fields are marked *