replace range still not working!
I cannot get replaceRange to work properly on a textArea, with words longer or shorter than the word i want to replace it meeses it all up! here is my code:
EditReplaceMenuItem.addActionListener(new ActionListener(){//action listener for "replace" menu item in edit menu
publicvoid actionPerformed(ActionEvent e){
String replace = JOptionPane.showInputDialog(null,"Replace:");//find word to replace
String with = JOptionPane.showInputDialog(null,"With:");//get word to replace with
int index = jtp.getSelectedIndex();//get selected tab index
JTextArea textArea = textAreas.get(index);//get textarea coreesponding to tab
String text = textArea.getText();//get text from that textarea
//replace code
int startIndex = 0;
Scanner scan =new Scanner(text);
while(scan.hasNext())
{
String current = scan.next();
if(current.equals(replace))
{
int start = text.indexOf(replace, startIndex);
int end = start + replace.length();
textArea.replaceRange(with, start, end);
}
startIndex += current.length();
}
}
});
here is a series of scrennshots which may help you see my problem : )
http://i41.photobucket.com/albums/e254/frahasio/howstrange.jpg
please help!

