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
p.getCaret().setSelectionVisible(true);