Hi, I am facing proble , which is as below: 1.I have got a JtextField on which i am doing validation on lostfocus() 2.But when one clicks the some button on Frame and focus was on the JTextField , two things happen: a)Lost Focus happens on JtextField. b)Jbutton_action_perfomed happens. 3. I want on such a click on button , the validation to be skipped out. 4. I think i can handle this case by invokelater() , but how? 5.Desired is: 1. On lostfocus , validation() will be excuted and returning focus back to JTextFiled. 2.On button click , i want to skip the execution of validation() by setting flag & skipping the run method of thread in invokelater(). This can be done in button_actionprformed(). Please send me the rough outline code for: 1.invokelater 2.processing to be done in button_actionperformed(). Pls help me urgently!! Thanks in advance. Dharmesh
If youare using Java 1.3 or later, you can use the class InputVerifier. myTextField.setInputVerifier(aVerifier); And if you want to avoid the check (for example with a cancel button), you can see the method setVerifyInputWhenFocusTarget.
You can look also to the class PlainDocument if you want some "clever" behaviour for your widget.