I wrote my own InputVerifier for JTextField and it works fine. Now I would like to “force” validation on this text field when user clicks a button. Is it possible to do?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Added as answer as @JarekMazur said it solved the problem.
Re-iterating my comment:
+1 @MadProgrammer for the docs
See this similar question/answer. It shows use how to programmatically trigger
JTextFieldenter key pressed usingRobotclass andrequestFocusInWindow(), though I think you would only need the latter.Try changing
JTextFieldfocus usingrequestFocusInWindow().You would initially request focus on the
JTextFieldand than to another component in order to fire theInput VerifiershouldYieldFocusmethod.