ActionListener running before focus listener

875 Views Asked by At

I have an application in which there is a textbox and a button. the textbox has focusListener(for incorrect values) and the button has actionListener(for saving the value into a file). An error message window pops up when a wrong value is entered in the textfield as soon as it loses focus. Now I have 2 senarios.

  1. when the focus is lost from tab out and if a wrong value is entered in the field then the pop up window shows up correctly.

  2. But when i enter a wrong value in the field and without tab out I click the button then the actionListener is activated before the focusListener(Focus Lost) and it saves the wrong value in the text file and then shows the error message.

How should I stop the incorrect value to be saved into file by running the focuslistener first?

1

There are 1 best solutions below

1
On

ActionListener running before focus listener