Problem with showing Message Dialog in InputVerifier -
1. It goes in a recurring loop
2.Shows StackOverflowError
It results in showing error message dialog in a recurrsive loop, Here is the solution to avoid it.
Solution :
boolean verified = false;
public boolean verify(JComponent input){
if (verified) {
return false;
}
verified = true;
JTextField sampleT= (JTextField) input;
if(sampleT.getText().equals("Exit")){
verified = false;
return true;
}else{
JOptionPane.showMessageDialog(source,"Can't leave.", "Error Dialog", JOptionPane.ERROR_MESSAGE);
verified = false;
return false;
}
}
Thursday, August 7, 2008
Subscribe to:
Posts (Atom)

