tags:

views:

362

answers:

2

I have a JDialog with a series of JTextFields on it I would like the text each to be selected when I tab to it.

+1  A: 

This exact question has been asked and answered, check it out here.

Short version: Add a focus listener to your text components and select all on focus, using SwingUtilities.invokeLater to ensure all pending AWT events have been processed.

thedude19
I did do a search first but didn't find that, thanks for pointing it out.
Lewis Jubb
No problem, glad to help.
thedude19
A: 

Call selectAll() in the focusGained() of the FocusListener

Aaron Digulla
That is not enough :)
eugener