public NowPlayingFrame(final File cfgFile) {
		this.cfgFile = cfgFile;

		frame = this;
		setTitle("NowPlaying - LastFM integration");
		setDefaultCloseOperation(javax.swing.WindowConstants.DO_NOTHING_ON_CLOSE);
		
		lastfmConfig = LastFmConfig.fromFile(cfgFile);
		config = Config.fromFile(cfgFile);
		
		
		configPanel = new ConfigPanel(this, lastfmConfig);
		
		previewTrack = new Track("Beyonce", "Halo", "I Am... Sasha Fierce");
		formatter = new Formatter(Formatter.DEFAULT_EXCEPTIONS);
		formatPanel = new FormatPanel(this, config, formatter, previewTrack);
		
		apiPanel = new ApiPanel(config, lastfmConfig, formatter);
		
		saveButton = new JButton("Save configuration");
		saveButton.addActionListener(new ActionListener() {
			@Override
			public void actionPerformed(ActionEvent e) {
				saveConfig();
			}
		});
		savePanel = new JPanel(new GridBagLayout());
		savePanel.add(saveButton);
		
		layout = new GroupLayout(getContentPane());
		getContentPane().setLayout(layout);
		
		layout.setHorizontalGroup(layout.createSequentialGroup()
			.addContainerGap()
			.addGroup(layout.createParallelGroup(GroupLayout.Alignment.CENTER)
				.addComponent(configPanel)
				.addComponent(formatPanel)
				.addComponent(apiPanel)
				.addComponent(savePanel)
			)
			.addContainerGap()
		);
		
		layout.setVerticalGroup(layout.createSequentialGroup()
			.addContainerGap()
			.addComponent(configPanel)
			.addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
			.addComponent(formatPanel)
			.addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
			.addComponent(apiPanel)
			.addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
			.addComponent(savePanel)
			.addContainerGap()
		);
		
		pack();
		
		addWindowListener(new WindowAdapter() {
		    public void windowClosing(WindowEvent e) {
		        LastFmConfig storedLfm = LastFmConfig.fromFile(cfgFile);
		        Config stored = Config.fromFile(cfgFile);
		        if (!stored.contentEquals(config) || !storedLfm.contentEquals(lastfmConfig)) {
		        	int opt = JOptionPane.showConfirmDialog(
		        			frame,
		        			"You have unsaved configuration changes.\nDo you want to save them?",
		        			"Unsaved changes",
		        			JOptionPane.YES_NO_CANCEL_OPTION);
		        	switch (opt) {
		        	case JOptionPane.YES_OPTION :
		        		saveConfig();
		        	case JOptionPane.NO_OPTION :
		        		System.exit(0);
		        		break;
		        	case JOptionPane.CANCEL_OPTION :
		        		break;
		        	default:
		        		LOG.error("Unknown response to closing window");
		        	}
		        } else {
		        	System.exit(0);
		        }
		    }
		});
	}