Java JTextComponent Select selectFirstArg(String strText, int initialSelectionStart, JTextComponent editor)

Here you can find the source of selectFirstArg(String strText, int initialSelectionStart, JTextComponent editor)

Description

select First Arg

License

Apache License

Declaration

private static void selectFirstArg(String strText, int initialSelectionStart, JTextComponent editor)
            throws BadLocationException 

Method Source Code

//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*/
    }
}

Related

  1. replaceSelectionAndSelect(JTextComponent component, String text)
  2. selectAll(final JTextComponent textComponent)
  3. selectAll(JTextComponent textComponent)
  4. selectAllOnFocus(JTextComponent textComponent)
  5. selectAndRequestFocus(JTextComponent editor)
  6. selectionToUpperCase(JTextComponent textPane)
  7. selectLines(JTextComponent target)
  8. toggleSelectionUpperCase(JTextComponent textPane)
  9. useSelectedTextColor(Highlighter.Highlight h, JTextComponent c)