Thursday, March 6, 2008

JFormattedTextField Selection Problems

While using JFormattedTextField I discovered that I couldn't programmatically set the text selection. If I called selectAll() on the component after it got focus, the cursor would invariably get set to position 0 and no text would be set.

I eventually found a discussion on the Sun Developer Network (SDN) on Bug 4740914

Use invokeLater() to call selectAll() on the component

No comments: