• Post Reply Bookmark Topic Watch Topic
  • New Topic

How to bypass InputVerifier

 
Avi Abrami
Ranch Hand
Posts: 1141
1
Java Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I have a Swing application that contains several JTextFields and JButtons.
The JTextFields have InputVerifiers which work correctly, i.e. you cannot navigate out of a
JTextField if invalid data is entered.
The application also has a "Exit" button, i.e. if the user activates that button, the
application terminates.
If I click on the "Exit" button immediately after entering invalid data in a JTextField,
the application doesn't terminate since the focus remains with the JTextField because of
the InputVerifier.
If the user wishes to terminate the application, then he should be allowed to even if he
has entered invalid data.
How can I achieve this? Is there a way to bypass the InputVerifier if the user activates
the "Exit" button?

Thanks,
Avi.
 
Avi Abrami
Ranch Hand
Posts: 1141
1
Java Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
OK, now I feel silly because I just found the answer:
Method 'setVerifyInputWhenFocusTarget' in class 'JComponent'.
So don't bother answering, people.
So is there a way to remove my question from the forum?

Sorry,
Avi.
 
Maneesh Godbole
Bartender
Posts: 11445
18
Android Eclipse IDE Google Web Toolkit Java Mac Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Avi Abrami wrote:
So is there a way to remove my question from the forum?

Since you have been considerate enough to post the answer, removing it would not help future people with similar problems if it is removed!
For you efforts you earned yourself a cow! Moo!
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!