Why the text in JTextPane cannot be selected programmatically if there is a JTextField present? Has something to do with focus i think. Thx.
import java.awt.Flow
Maybe you should be using a Highlighter so the highlighting appears in all text components:
Highlighter.HighlightPainter yellow =
new DefaultHighlighter.DefaultHighlightPainter( Color.YELLOW );
try
{
textPane.getHighlighter().addHighlight(2, 4, yellow);
}
catch(BadLocationException ble) { System.out.println(ble); }