I am developing a Java Swing Application.
The application ends with a form to take the customer's input information (name, last name, email, gender, etc)
I am trying to validate the text fields in a way that when the application is launched focus will go on the first text box (first name). I want the user to not be able to leave the box until they have entered a valid name (no numbers, punctuation and so on).
Unfortunately even after looking online, I am not able to find a solution to validating these boxes.
Action Plan:
Focus on first textfield >>> Unable to leave unless valid input is entered >> messages outputted to user >> validation completed >> focus set on next field >> and so on.
Help would be appreciated.
What I have tried:
i have tried focus lost listener to deal with it but could't succeed.