textComp.select(start, end); textComp.replaceSelection(s);
JTextComponent.this.select(start, end); JTextComponent.this.replaceSelection(s);
    public void replaceText(int start, int end, String s)    {      textComp.select(start, end);      textComp.replaceSelection(s);    }