Here you can find the source of selectAndRequestFocus(JTextComponent editor)
public static void selectAndRequestFocus(JTextComponent editor)
//package com.java2s; //License from project: Apache License import javax.swing.text.JTextComponent; public class Main { public static void selectAndRequestFocus(JTextComponent editor) { editor.requestFocusInWindow();//from w w w. ja va 2 s . c o m editor.selectAll(); } }