Skip to main content

Posts

Showing posts from February, 2014

Taking care of user inputs: Using jFormattedTextFields

When developing an application, it is critical to validate the user inputs. In order to give the right output the right input should be given. But the users don't always provide the right inputs as we expect, the right design should have the ability to deal with all kinds of bizarre inputs that user might give in. One way to handle them is validating the given inputs before we process it. But it is better to limiting the user to type something we don't expect. In Java swing we can use formatted text fields for this task. This is a quick tutorial for jFormattedTextFields using Netbeans. This will be enough to get it done, and I won't go more details on it. Formatted text field is very similar to the simple jTextField but we can set a format that it would only accept as an input. Therefor user will not be able to type anything else other than the given format. First let's look doing that easily using Netbeans IDE. Netbeans provides jFormattedTextField in the