Java program for validating username and password

In Java8 this would be done with Functions, but, let's use an interface for the moment: In fact, I would personally go for an even more sophisticated approach that also separates the types of results to make changes to the logic even easier.

But this might be over-engineering it at this point. It's a bit more readable and much faster in case logging is off (and most logging is off most of the time). Can't you the returned value instead of the very similar message? like if there isn't an uppercase, but that could get monotonous if you fail the checks one at a time.

, provides specialized text fields for password entry.

For security reasons, a password field does not show the characters that the user types.

After Button, the most used AWT component is Text Field.Programmatically, the Text Field can be made non-editable.Pressing Enter key generates Action Event and can be handled by Action Listener.Limitations of Text Field One small limitation of Text Field is it allows entering or displaying only one line of text; of course of any length.Anyhow, this limitation is overcome with Text Area, another AWT component.