This is actually a bug in the Windows look and feel (it ought to behave like this by default)... Anyhoo, here's one way of solving it:
Rather than adding listeners directly to the field, instead change the caret implementation. The caret implementation is a mouse listener and a focus listener. You override the focus listening stuff to select all the text in the field, but in the mouse listening code, you save the current caret position before calling requestFocus() then reset the caret position after focus has been gained.
Something like this:
Should do the trick
Brian
[ August 23, 2002: Message edited by: Brian Duff ]