How to select text in JTextField during tab

I have JDialoga series JTextFieldon it. I would like each text to be selected when I click on it.

+3
source share
2 answers

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

Short version: Add a focus listener to your text components and select everything in focus using SwingUtilities.invokeLater so that all AWT events handled are processed.

+6
source

Call selectAll()infocusGained() FocusListener

+5
source

Source: https://habr.com/ru/post/1715721/


All Articles