I have a class which implements FocusListener,ActionListener. This Focus listener is used for a field named "Field 1" and the ActionListener is used for the buttons in the class. I have 2 buttons 'Save', 'Cancel'.
The validation for Field 1 should happen only for Save. The validation i am doing is the Field 1 should have 10 digits. If its not, it will throw error to the user.
The problem is when I click on 'Cancel' button, it is going into FocusLost() method and finding that "Field 1" is not having 10 digits and throwing error. Its not going into the actionPerformed() method of Cancel button. So, i was not able to execute Cancel button.
How will i identify that I clicked Cancel button (ActionEvent) in FocusLost() method??