private void csvButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_csvButtonActionPerformed
        String filename = null;
        String buffer = null;
        
        filename = askSaveFilename("Export CSV", Config.getLastExportDirectory());

        if (filename == null) {
            return;
        }
        Config.setLastExportDirectory(filename);
        if (!Config.getLastExportDirectory().isDirectory()) {
            Config.setLastExportDirectory(Config.getLastExportDirectory().getParentFile());
            Config.save();
        }

        buffer = thegraph.make_csv();

        if ( GlobalOptions.isDodebug() ) {
            System.out.println(buffer);
        }
        BufferedWriter out = null;
        try {
            out = new BufferedWriter(new FileWriter(filename));
        } catch (IOException e) {
            out = null;
        }
        if ( out == null ) {
            return;
        }
        try {
            out.write(buffer);
            out.flush();
            out.close();
        } catch (IOException e) {
            
        }
        

    }//GEN-LAST:event_csvButtonActionPerformed