import java.io.*; public class FindAndReplDriver { public static void main(String[] args) { FindAndRepl frame = new FindAndRepl(); frame.show(); BufferedReader in = new BufferedReader( new InputStreamReader(System.in)); do { try { System.out.print("Specify a valid file name: "); /* send user input to readFile */ frame.readFile(in.readLine()); /* add the part below */ System.out.print("Enter the string to find" + " [ENTER if none]: "); String f = in.readLine(); while (!f.equals("")) { // a string to find was entered System.out.print("Enter a replacement string" + " [ENTER if none]: "); String r = in.readLine(); frame.findString(f, r); System.out.print("Enter the string to find" + " [ENTER if none]: "); f = in.readLine(); } /* end of added part */ } catch (IOException e) {} // some IO error is ignored } while(true); // loops until the window is closed } }