public GUIDisplay(ISearchSpace searchSpace) 
	{
		super(searchSpace);
		
		displaySearchSpace(new Object());

		/* the frame configuration */
		super.setTitle("AStar Optimal Path");
		super.setSize(400, 500);
		super.setLocationRelativeTo(null);
		super.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		super.setVisible(true);

		/* Button Action Listener */
		button.addActionListener(new ActionListener() 
		{
			public void actionPerformed(ActionEvent e) 
			{
				/* Open a file if the search space is empty */
				if (displayableSpace.getVerticalLength() == 0 || inputfile.isEmpty())
				{
					JFileChooser fileChooser = new JFileChooser();
					if (fileChooser.showOpenDialog(null) == JFileChooser.APPROVE_OPTION)
					{
						String buttonText = "Calculate";
						File file = fileChooser.getSelectedFile();
						inputfile = file.getAbsolutePath();
						int idx = inputfile.lastIndexOf('\\');
						outputFile = inputfile.substring(0,idx) + "\\output.txt";

						ValidateInput validateInput = new ValidateInput(inputfile);
						try 
						{
							if (validateInput.isValid())
							{	
								try 
								{
									displayableSpace.loadSearchSpace(inputfile);	
								} 
								catch (IOException e1) 
								{
									JOptionPane.showMessageDialog(new JPanel(), e1.getMessage(), "IO Error", JOptionPane.ERROR_MESSAGE);
									buttonText = "Open";
								}
							}
							else
							{
								buttonText = "Open";
							}
						} 
						catch (Exception e1) 
						{
							JOptionPane.showMessageDialog(new JPanel(), e1.getMessage(), "IO Error", JOptionPane.ERROR_MESSAGE);
							buttonText = "Open";
						}

						populate();
						button.setText(buttonText);
					}

				}
				/* Action to perform when in the calculate state */
				else if (button.getText().equals("Calculate"))
				{
					AStar astar = new AStar(displayableSpace);
					long startTime = System.currentTimeMillis();
					astar.search();
					long endTime = System.currentTimeMillis();
					displayableSpace.printShortestPath();
					populate();
					setStatistics (endTime-startTime,
							displayableSpace.shortestPathLength(), 
							displayableSpace.costOfShortestPath());
					button.setText("Exit");
					Display fileDisplay = new FileDisplay(displayableSpace);
					((FileDisplay)fileDisplay).setStatistics (endTime-startTime,
							displayableSpace.shortestPathLength(), 
							displayableSpace.costOfShortestPath());
					fileDisplay.displaySearchSpace(outputFile);
				}
				else if (button.getText().equals("Exit"))
				{
					System.exit(0);
				}
			}
		});

	}