When a JTextField gets the focus by calling "aJTextField.requestFocus()", why is the Caret invisible even after I do "aJTextField.getCaret().setVisible(true);"? How to show the caret in this case?
Created May 4, 2012
Sandip Chitale
You have to call requestFocus() on the Swing thread. To do that do the following -
SwingUtilities.invokeLater( new Runnable() { public void run() { aJTextField.requestFocus(); aJTextField.getCaret().setVisible(true); } } );