Week 09 assignment

advertisement
Week 09 assignment
In this assignment you will create a Java class named TextFileEditor.
1. Create a window that looks much
like the one at the left.
2. The button marked “…” should
invoke a Chooser to allow the user
to navigate to an input file. The text
box (labeled “File to Process :”) to
the left of the “…” button should be
filled in with the fully-qualified file
specification returned by the
chooser.
3. The “Go!” button will open the
specified file, and read it on a lineby-line basis.
4. After each line is read,
a. Increment the count of the “Count Occurrences of” string. Counts should either ignore case
or not, according to the status of the “Ignore Case” check box.
b. Replace all occurrences of the “Replace” string with the “With” string. Searches should be
either case-sensitive or not, as indicated by the checkbox.
c. Write the edited line to the output file. The output file should be in the same folder as the
input file, except that its file name should be taken from the “Output File Name” textbox.
5. The label string shown below the “Go!” button should be blank initially. After end-of-file is detected
in the input file, and the output file is closed, it should appear as shown, giving number of lines
processed, the counts of the “Count Occurrences of” string, and the number of replacements.
Turn in your java files in the Drop box by noon on Sunday for a 10% bonus. Otherwise, assignments will
be due 11:59 pm on Monday March 8th.
Download