public br.readLine()) != null) {//reads through all the

public void findString(String word, String filename) throws IOException{// used to find how many times a word appears and in what line in the list        int count = 0;        try (LineNumberReader ln = new LineNumberReader(new FileReader(filename))) {// uses linenumberreader to find the words        String line;        while ((line = ln.readLine()) != null) {// while the line is not equal to null        for (String element : line.split(” “)) {// splits apart the different strings found in the list in order to tbe able to compare them later        if (element.equalsIgnoreCase(word)) {// it compares strings to find the selected one        count++;        jTextPane1.setText(jTextPane1.getText() + “Word found at line ” + ln.getLineNumber() + ”
“);// prints where the word is found        }        }        }        jTextPane1.setText(jTextPane1.getText() + “In total, the word was found ” + count + ” times” + ”
“);// prints how many times the word was found        }        jTextPane1.setText(jTextPane1.getText() + “——-” + ”
“);// acts as a divider so the user can clearly see where the text ends        }        public static void fileSort(String filename) throws Exception {//sorts the file alphabetically        FileReader fr = new FileReader(filename);        BufferedReader br = new BufferedReader(fr);        String inputLine;        List lineList = new ArrayList();//creates an arraylist consisting of strings        while ((inputLine = br.readLine()) != null) {//reads through all the lines        lineList.add(inputLine);        }        fr.close();        Collections.sort(lineList);//used to do the main sorting in the list        FileWriter fr2 = new FileWriter(filename);        PrintWriter out = new PrintWriter(fr2);        for (String outputLine : lineList) {//acts as a condensed for statement, for each outputLine in the array        out.println(outputLine);//prints the sorted list back into the file        }        out.flush();        out.close();        fr2.close();        }            public static void sendToFile (String filename) throws IOException {// puts the words into the file        BufferedWriter ow = new BufferedWriter(new FileWriter(filename));        while (true) {        String output = JOptionPane.showInputDialog(“Enter a word, press cancel to stop”);        if (output == null) {// if an empty space is entered it will just break        break;        } else {        ow.write(output);//output is written into the file        ow.newLine();//new line made        }        }        ow.flush();        ow.close();        }                public void fileRead (String filename) throws IOException {// prints all the words in the file        try (BufferedReader br = new BufferedReader(new FileReader(filename))) {        String line = null;        while ((line = br.readLine()) != null) {//while the read line is not null        jTextPane1.setText(jTextPane1.getText() + line + ”
“);//the text gets printed out        }        jTextPane1.setText(jTextPane1.getText() + “——-” + ”
“);// acts as a divider so the user can clearly see where the list ends        }        }