JDK-6430995 : two carats appear in JTextfields when multiple EventQueues are active
  • Type: Bug
  • Component: client-libs
  • Sub-Component: java.awt
  • Affected Version: 5.0u6
  • Priority: P3
  • Status: Closed
  • Resolution: Duplicate
  • OS: windows_xp
  • CPU: x86
  • Submitted: 2006-05-26
  • Updated: 2011-01-19
  • Resolved: 2006-11-09
Related Reports
Duplicate :  
Relates :  
Description
Under certain circumstances, a Java Applet can show two flashing carats at the same time, each in a different JTextField.  This appears to be down to a mix of using multiple EventQueues and the performance of the system running the applet being relatively low, suggesting a race condition.

See Comments for test case and workaround solution.

Comments
EVALUATION Swing is not thread-safe (doing stuff outside of the EDT should be considered "illegal" in Swing). Such "illegal" actions existed in AWT code before fix for 6448190. Although it's already fixed in 5.0u10. Before fix for cr#6448190 pending lightweight requests were processed on incorrect appcontext (see cr#6448190 for more information).
05-06-2006

WORK AROUND Quoting the customer: Our workaround for that is to set our focus inside a new Runnable which is invoked later (EventQueue.invokeLater). With this workaround we did not get the doubled caret anymore - after really excessive testing.
26-05-2006