Problem retaining focus
Hi all,
I do maintenance on a piece of code that, although I am not highly experienced, I believe has a design flaw that I am having difficulty getting around.
A JPanel has many instantiated MyTextFields. The public class MyTextField extends JTextField and implements ActionListener and each field has an InputVerifier and FocusListener set/added. Back in the JPanel where the text fields are instantiated with MyTextField they then have FocusListeners added to them.
When focus is lost on one of these fields the MyTextField InputVerifier and FocusAdapter are first to receive the event followed by the FocusAdapter that was added to the already instantiated text field. The original coder did not understand this I'm sure because they put into the second FocusAdapter focusLost() methods what they thought would be a trap - setting a MyTextField object flag called 'holdFocus'. The MyTextField InputVerifier verify() method is supposed to jump out of the verify() method returning false if the flag was set. But the flag gets set after the method is run. The proof of this, if it is needed, is that if I go back into the text field then exiting it takes two clicks.
QUESTION: Is there a way for me to on a case by case basis remove the first FocusAdapter and use the second one. Or something else...
Thanks for any feedback.
hopi

