Preventing a JButton from being clicked
Posted on 2004-04-26
I have an application where I have to validate different fields. Before a field may lose the focus, the validation has to be performed and if it fails the field may not lose the focus. My problem is that whenever I have buttons on the form as well, these buttons can be clicked even though the validation failed and the button should not receive an actionEvent.
Is there a way to stop the button from receiving an actionPerformed event in the cases where the validation fails and the focus is not allowed to leave the edit field?