public void saveDataToFile(String first, String last, boolean isSaveAs)
	throws IllegalArgumentException, Exception {
		setFirstName(first);
		setLastName(last);
                
                // If no selected file from load operation then let user
                // choose wehre to save file, otherwise us Save As ...
                if(selectedFile == null || !selectedFile.exists() || isSaveAs) {
		
                    // Build a file chooser component that displays files only
                    JFileChooser fileChooser = new JFileChooser();
                    fileChooser.setFileSelectionMode( JFileChooser.FILES_ONLY );
                    fileChooser.setApproveButtonText("Save");
                    fileChooser.setDialogTitle("Save Name Changes");
                    fileChooser.addChoosableFileFilter(new TxtFilter());

                    // check if user clicked Cancel button on dialog, if so, return
                    int result = fileChooser.showOpenDialog( comp );
                    if( result == JFileChooser.CANCEL_OPTION ) {
                            throw new Exception("Save operation cancelled.");
                    }
                    selectedFile = fileChooser.getSelectedFile();
                }
		  
                PrintWriter out = new PrintWriter(
                                     new BufferedWriter(
                                     new FileWriter(selectedFile, false)));
                out.println("name=" + firstName + " " + lastName);
                out.close();
	}