JDK-4532517 : shouldYieldFocus does not allow side effects in 1.4
  • Type: Bug
  • Component: client-libs
  • Sub-Component: javax.swing
  • Affected Version: 1.4.0,1.4.1
  • Priority: P4
  • Status: Resolved
  • Resolution: Fixed
  • OS:
    generic,windows_nt,windows_2000,windows_xp generic,windows_nt,windows_2000,windows_xp
  • CPU: generic,x86
  • Submitted: 2001-11-28
  • Updated: 2003-08-15
  • Resolved: 2003-08-15
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
Other
5.0 tigerFixed
Related Reports
Duplicate :  
Duplicate :  
Relates :  
Relates :  
Description
shouldYieldFocus does not allow side effects such as popping up a OptionPane.

Comments
CONVERTED DATA BugTraq+ Release Management Values COMMIT TO FIX: tiger FIXED IN: tiger INTEGRATED IN: tiger tiger-b16
14-06-2004

EVALUATION Something seems to have changed which is not allowing side-effects in shouldYieldFocus(). There is a workaround available. Need to investigate more. ###@###.### 2001-12-05 A typical use case for shouldYieldFocus is to show a dialog. In 1.4 showing a dialog would result in a focus trasfer and we again ask the InputVerifier if it shouldYieldFocus which would show another dialog... The fix is to NOT call into the InputVerifier if we have already called into the InputVerifier. ###@###.### 2003-08-08
08-08-2003

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
26-11-2001