public PreferencesDialog(Frame parent, Preferences preferences) {
   	super(parent, TITLE, true);
      this.parent = parent;
      this.preferences = preferences;

      this.setResizable(false);

   	JPanel cp = (JPanel) this.getContentPane();
   	cp.setLayout(new GridBagLayout());

   	buttonPanel.add(okButton);
   	buttonPanel.add(cancelButton);

   	JLabel engineVersionLabel = new JLabel("Preferred Engine format for editing resources: ");
   	JRadioButton mm6EngineVersionButton = new JRadioButton("MM6 engine");
   	JRadioButton mm7EngineVersionButton = new JRadioButton("MM7 engine");
   	JRadioButton mm8EngineVersionButton = new JRadioButton("MM8 engine");
   	JRadioButton unknownEngineVersionButton = new JRadioButton("unknown engine");
   	
   	switch (AdditionalPreferences.getInstance().getGameVersion())
   	{
		case GameVersion.MM6:
			mm6EngineVersionButton.setSelected(true);
   		   	break;
   		case GameVersion.MM7:
   			mm7EngineVersionButton.setSelected(true);
   		   	break;
   		case GameVersion.MM8:
   			mm8EngineVersionButton.setSelected(true);
   		   	break;
   		case GameVersion.UNKNOWN:
   		default:
   		   	unknownEngineVersionButton.setSelected(true);
   		   	break;
   	}

   	JPanel optionsPanel = new JPanel(new GridLayout(5, 1, 4, 4));
    optionsPanel.add(engineVersionLabel);
    optionsPanel.add(mm6EngineVersionButton);
    optionsPanel.add(mm7EngineVersionButton);
    optionsPanel.add(mm8EngineVersionButton);
    optionsPanel.add(unknownEngineVersionButton);

    //Group the radio buttons.
    ButtonGroup engineVersionGroup = new ButtonGroup();
    engineVersionGroup.add(mm6EngineVersionButton);
    engineVersionGroup.add(mm7EngineVersionButton);
    engineVersionGroup.add(mm8EngineVersionButton);
    engineVersionGroup.add(unknownEngineVersionButton);

    mm6EngineVersionButton.addActionListener(new ActionListener() {
    	
		public void actionPerformed(ActionEvent e) {
			if (((JRadioButton)e.getSource()).isSelected())
			{
				AdditionalPreferences.getInstance().setGameVersion(GameVersion.MM6);
			}
		}
	});
    mm7EngineVersionButton.addActionListener(new ActionListener() {
		public void actionPerformed(ActionEvent e) {
			if (((JRadioButton)e.getSource()).isSelected())
			{
				AdditionalPreferences.getInstance().setGameVersion(GameVersion.MM7);
			}
		}
	});
    mm8EngineVersionButton.addActionListener(new ActionListener() {
		public void actionPerformed(ActionEvent e) {
			if (((JRadioButton)e.getSource()).isSelected())
			{
				AdditionalPreferences.getInstance().setGameVersion(GameVersion.MM8);
			}
		}
	});
    unknownEngineVersionButton.addActionListener(new ActionListener() {
		public void actionPerformed(ActionEvent e) {
			if (((JRadioButton)e.getSource()).isSelected())
			{
				AdditionalPreferences.getInstance().setGameVersion(GameVersion.UNKNOWN);
			}
		}
	});

   	ComponentDeployer.deploy(cp, optionsPanel,  GridBagConstraints.CENTER,     GridBagConstraints.REMAINDER, 1, GridBagConstraints.BOTH, 1.0, 1.0, new Insets(15, 15, 15, 15));
   	ComponentDeployer.deploy(cp, buttonPanel,  GridBagConstraints.SOUTH,     GridBagConstraints.REMAINDER, 1, GridBagConstraints.NONE, 0.0, 0.0, new Insets(15, 15, 15, 15));

   	this.pack();
      WindowUtilities.centerOnScreen(this);

   	this.addWindowListener(new WindowAdapter() {
   	   public void windowClosing(WindowEvent e) {
   	      PreferencesDialog.this.dispose();
   	   }
   	});

   	cancelButton.addActionListener(new ActionListener() {
         public void actionPerformed(ActionEvent e) {
   	      PreferencesDialog.this.dispose();
   	   }
   	});

   	okButton.addActionListener(new ActionListener() {
   	   public void actionPerformed(ActionEvent e) {
   	   }
   	});

   	this.getRootPane().setDefaultButton(okButton);
   }