用awt写的记事本,如何实现替换?这个是查找的代码:其中father是指主窗体
int index=0;
if(e.getSource()==b1)
{
String nr=father.ta.getText().trim();
String sr=tf1.getText().trim();int location=nr.indexOf(sr,index);
System.out.println(location);
if(location>=0)
{
index=location+1;
father.requestFocus();
father.ta.requestFocus();
father.ta.setSelectionStart(location);
father.ta.setSelectionEnd(location+sr.length());
}
}
实现替换的应该怎么写,怎么样将主文本区起始位置的代码替换掉?