I am writing a program containing several JTextFields and 2 JTextAreas inside an input panel. I have a submit button below. I configured it so that when the user types something in each field (including JTextAreas) and presses the Enter key, he updates the text file, and when he presses the submit button, he updates the file and then displays a new version of the local directory.
If the user presses Enter in any of the fields, he checks their input, however I want to re-check all the fields when they press the submit button. Each field (again, JTextAreas is included) has its own validation check inside its ActionListener or KeyListener (for JTextAreas). It is simple enough to use postActionEvent () for JTextFields, but is there a similar method for JTextAreas to force Fire KeyEvent? . I don't want to duplicate code and consume memory by rewriting validation for these 2 components inside an ActionEvent for JButton.
Unfortunately, I cannot provide a sample because I am writing a program on a secret machine (PC).
source share