public void setOpenFile() //sets file instance variable
  {  
    file = null;  //In case it was set previously
    JFileChooser fileChooser = 
    	           new JFileChooser(new File(System.getProperty("user.dir")));
    //Set the mode of the browse tool:
    fileChooser.setFileSelectionMode(JFileChooser.FILES_ONLY);
    fileChooser.setDialogTitle("Load File"); //Dialog box title bar
    int option = fileChooser.showOpenDialog(null); //Lets user browse to file 
    if(option == JFileChooser.APPROVE_OPTION) //User chooses OK
    {
      file =  fileChooser.getSelectedFile();  //get chosen file to be loaded
      if (!hasFile()) // if user selects OK but doesn't select file
        JOptionPane.showMessageDialog(null, "Unsuccessful:  empty filename"); 
    }
  }