Here you can find the source of selectFirstArg(String strText, int initialSelectionStart, JTextComponent editor)
private static void selectFirstArg(String strText, int initialSelectionStart, JTextComponent editor) throws BadLocationException
//package com.java2s; //License from project: Apache License import javax.swing.text.BadLocationException; import javax.swing.text.JTextComponent; public class Main { private static void selectFirstArg(String strText, int initialSelectionStart, JTextComponent editor) throws BadLocationException { int firstParen = strText.indexOf("("); if (firstParen >= 0 && firstParen < strText.indexOf(")")) { int startPos = initialSelectionStart + firstParen + 1; editor.setCaretPosition(startPos); }/*from ww w . jav a 2 s . c o m*/ } }