WORK AROUND
public boolean shouldYieldFocus(JComponent input) {
if (verify(input)) {
return true;
}
// According to the documentation should yield focus is allowed to cause
// side effects. So temporarily remove the input verifier on the text
// field.
input.setInputVerifier(null);
System.out.println("Removed input verifier");
// Pop up the message dialog.
String message = "Roll over the 'JButton1' with mouse pointer "
+ "after closing this dialog.\nIt sometimes behaves correctly "
+ "for the first time\n but repeating action brings incorrect "
+ "behaviour of button.";
JOptionPane.showMessageDialog(null, message , "invalid value",
JOptionPane.WARNING_MESSAGE);
System.out.println("Showed message.");
// Reinstall the input verifier.
input.setInputVerifier(this);
System.out.println("Reinstalled input verifier");
// Tell whoever called us that we don't want to yeild focus.
return false;
}
###@###.### 2001-11-26
|