Jump to Real's How-to Main page

Stop the beep on JFormattedTextField

When the user inputs an invalid value into JFormattedTextField, the default behavior is to emit a beep. To avoid this annoying beep, simply overload the invalidEdit() method.
class MyJFormattedTextField extends JFormattedTextField {
...
protected void invalidEdit() {}
...
}

If you find this article useful, consider making a small donation
to show your support for this Web site and its content.

Written and compiled by Réal Gagnon ©1998-2005
[ home ]