Yeah, remove or comment out this code. New code will be
import javax.swing.JTextArea;
import javax.swing.JScrollPane;
import javax.swing.JFrame;
import javax.swing.JPanel;
import java.io.File;
import java.util.Scanner;
import java.awt.GridLayout;
import java.util.NoSuchElementException;
import java.io.FileNotFoundException;
import java.io.BufferedReader;
import java.io.FileReader;
import java.io.LineNumberReader;
import java.io.IOException;
public class FileReadingTesting
{
public static void main(String[] args)
{
Scanner console = null;
LineNumberReader lnr = null;
String areaText = "";
String area2Text = "";
String area3Text = "";
try{
console = new Scanner(new File("Silly.txt"));
}
catch(FileNotFoundException fnfe)
{
System.out.println("Not found.");
}
Scanner lineScanner = null;
while(console.hasNext())
{
//System.out.println(console.next());
String temp = console.next();
if (temp.equals("<Page1>"))
{
while (console.hasNext() && !console.nextLine().equals("</Page1>"))
{
String nextInputLine = console.nextLine();
lineScanner = new Scanner(nextInputLine);
while(lineScanner.hasNext())
{
areaText = areaText + lineScanner.nextLine();
}
areaText = areaText + "\n" + "\n";
}
}else if (temp.equals("<Page2>"))
{
while (console.hasNext() && !console.nextLine().equals("</Page2>"))
{
String nextInputLine = console.nextLine();
lineScanner = new Scanner(nextInputLine);
while(lineScanner.hasNext())
{
areaText = areaText + lineScanner.nextLine();
}
areaText = areaText + "\n" + "\n";
}
}
}
System.out.println(areaText);
System.out.println(area2Text);
JFrame wenguin = new JFrame("Parsing test");
wenguin.setVisible(true);
JPanel panel = new JPanel();
wenguin.setContentPane(panel);
JTextArea area = new JTextArea(100,100);
JScrollPane pane = new JScrollPane(area, JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED, JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
JTextArea area2 = new JTextArea(100,100);
JScrollPane pane2 = new JScrollPane(area2, JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED, JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
JTextArea area3 = new JTextArea(100,100);
JScrollPane pane3 = new JScrollPane(area3, JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED, JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
panel.setLayout(new GridLayout(3,1));
panel.add(pane);
panel.add(pane2);
panel.add(pane3);
char c = 'a';
String t = "";
area.setText(areaText);
area2.setText(area2Text);
wenguin.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
}
}