// Project: Recursion // Module: maze // Source code file: MyFrame.java // Compute and display the path that // connects the start point to the end point. // Show solution in yellow. import javax.swing.*; import java.awt.*; import java.awt.event.*; import java.util.StringTokenizer; import java.io.*; public class MyFrame extends JFrame { private MyPanel p; private int width, height; private String line; private BufferedReader br; public MyFrame() { super("Maze Example"); try { br = new BufferedReader( new FileReader("maze/src/maze.txt")); line = br.readLine(); StringTokenizer st = new StringTokenizer(line, " "); height = Integer.parseInt(st.nextToken()); width = Integer.parseInt(st.nextToken()); } catch(IOException e) { System.out.println(e); } p = new MyPanel(width, height, br); p.setLayout(new FlowLayout()); setContentPane(p); setSize(8*width+10, 8*height+28); show(); } }