public static void exportCSV(JTable main){
	String fileurl;
	JFileChooser chooser = new JFileChooser();
	File file = new File("Schedule.csv");
	
	int returnVal = chooser.showSaveDialog(null);
	if(returnVal == JFileChooser.APPROVE_OPTION){
	 file = chooser.getSelectedFile();
	 String filePath = file.getPath();
	 if(!filePath.toLowerCase().endsWith(".csv"))
	 {
	     file = new File(filePath + ".csv");
	 }

	try {
		PrintWriter writer = new PrintWriter(file, "UTF-8");
		int max = main.getColumnCount() - 1;
		for(int i=0; i<main.getColumnCount(); i++){
		writer.print(main.getColumnName(i));
		if(i< max) writer.print(",");
		}
		writer.println();
		printTable(main, writer);
		
		writer.close();
		
	} catch (FileNotFoundException e) {
		// TODO Auto-generated catch block
		e.printStackTrace();
	} catch (UnsupportedEncodingException e) {
		// TODO Auto-generated catch block
		e.printStackTrace();
	}
	
	} else if(returnVal == JFileChooser.CANCEL_OPTION){
		
	}

	
}