public MainFrame(final String title) throws IOException {
        super(title);
        
        JPanel mainPanel = new JPanel();
		mainPanel.setLayout(new BoxLayout(mainPanel, BoxLayout.Y_AXIS));
		mainPanel.setAlignmentX(Component.CENTER_ALIGNMENT);
		
		JPanel csvPanel = new JPanel();//new FlowLayout());
		csvPanel.setLayout(new BoxLayout(csvPanel, BoxLayout.Y_AXIS));
		csvPanel.setAlignmentX(Component.CENTER_ALIGNMENT);
		
		JPanel svgPanel = new JPanel();//new FlowLayout());
		svgPanel.setLayout(new BoxLayout(svgPanel, BoxLayout.Y_AXIS));
		svgPanel.setAlignmentX(Component.CENTER_ALIGNMENT);
		
		JPanel generatePanel = new JPanel();
		generatePanel.setLayout(new BoxLayout(generatePanel, BoxLayout.X_AXIS));
		generatePanel.setAlignmentX(Component.CENTER_ALIGNMENT);
		
		
		JButton buttonLoad = new JButton("Load CSV File");
		buttonLoad.setAlignmentX(Component.CENTER_ALIGNMENT);
		final JLabel csvFileLabel = new JLabel("CSV file...");
		csvFileLabel.setAlignmentX(Component.CENTER_ALIGNMENT);
		final JLabel svgFileLabel = new JLabel("SVG file...");
		svgFileLabel.setAlignmentX(Component.CENTER_ALIGNMENT);
		
		buttonLoad.addActionListener(new ActionListener() {
			
			@Override
			public void actionPerformed(ActionEvent arg0) {
				JFileChooser fc = initOpenFileChooser();
				int returnVal = fc.showOpenDialog(MainFrame.this);

		        if (returnVal == JFileChooser.APPROVE_OPTION) {
		            File file = fc.getSelectedFile();
		            csvFile = file.getAbsolutePath();
		            csvFileLabel.setText(csvFile);
		            if (validCsv()){
			            //This is where a real application would open the file.
			            //System.out.println("Opening: " + csvFile );
			            buttonLineChart.setEnabled(true);
			            buttonBarChart.setEnabled(true);
		            /*}
		            else{*/
						svgFileLabel.setText("SVG file...");
					}
		        } else {
		        	System.out.println("Open command cancelled by user." );
		        }
			}

		});
		
		//JButton buttonSave = new JButton("Save SVG File");
		//buttonSave.setAlignmentX(Component.CENTER_ALIGNMENT);
		
		/*buttonSave.addActionListener(new ActionListener() {
			
			@Override
			public void actionPerformed(ActionEvent arg0) {
				//showSaveDialog(svgFileLabel);
			}			

		});*/

		buttonBarChart.setEnabled(false);
		buttonBarChart.setAlignmentX(Component.CENTER_ALIGNMENT);
		buttonBarChart.addActionListener(new ActionListener() {
			
			@Override
			public void actionPerformed(ActionEvent arg0) {
				
				int dialog = showSaveDialog(svgFileLabel);
				if (dialog == JFileChooser.APPROVE_OPTION){
					try {
						if (validFiles()){
							createBarChart(csvFile, svgFile);
							svgFileLabel.setText("Bar chart created succesfully in: " + "\n" + svgFile);
						}
						else{
							svgFileLabel.setText("SVG file...");
							//buttonLineChart.setEnabled(false);
				            //buttonBarChart.setEnabled(false);
						}
					} catch (Exception e) {
						JOptionPane.showMessageDialog(MainFrame.this, "Please verify the CSV file.");
						e.printStackTrace();
					}
				}
			}

		});
		
		buttonLineChart.setEnabled(false);
		buttonLineChart.setAlignmentX(Component.CENTER_ALIGNMENT);
		buttonLineChart.addActionListener(new ActionListener() {
			
			@Override
			public void actionPerformed(ActionEvent arg0) {
				int dialog = showSaveDialog(svgFileLabel);
				if (dialog == JFileChooser.APPROVE_OPTION){
					try {
						if (validFiles()){
							createLineChart(csvFile, svgFile);
							svgFileLabel.setText("Line chart created succesfully in: " + "\n" + svgFile);
						}
						else{
							svgFileLabel.setText("SVG file...");
						}
					} catch (Exception e) {
						JOptionPane.showMessageDialog(MainFrame.this, "Please verify the CSV file.");
						e.printStackTrace();
					}
				}
			}

		});
		
        csvPanel.add(buttonLoad);
        csvPanel.add(csvFileLabel);
        
        generatePanel.add(buttonBarChart);
        generatePanel.add(buttonLineChart);
        
      //svgPanel.add(buttonSave);
        svgPanel.add(svgFileLabel);
        
        this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		this.setMinimumSize(new Dimension(600, 270));
		
		mainPanel.add(Box.createVerticalStrut(30));
		mainPanel.add(csvPanel);
		mainPanel.add(Box.createVerticalStrut(30));
		mainPanel.add(generatePanel);
		mainPanel.add(Box.createVerticalStrut(20));
		mainPanel.add(svgPanel);
		this.setContentPane(mainPanel);
    }