
// Project: webCDwriter - Network CD Writing
// Author: Jörg Haeger, 10.05.2000
//	joerg.haeger@Uni-Bielefeld.de

import java.awt.*;
import java.awt.event.*;
import javax.swing.*;

public class TypesDialog extends JDialog
{
	private JRadioButton dataButton, imageButton, audioButton;

	public TypesDialog()
	{
		super(CDcreator.mainWin, i18n("titleTypes"), true);
		setDefaultCloseOperation(JDialog.DO_NOTHING_ON_CLOSE);

		JPanel selectionPanel = new JPanel()
		{
			public Insets getInsets() {
				return new Insets(10, 10, 10, 10);
			}
		};
		selectionPanel.setLayout(
			new BoxLayout(selectionPanel, BoxLayout.Y_AXIS));

		selectionPanel.add(new JLabel(i18n("selectMode")));

		dataButton = new JRadioButton(i18n("dataCD"));
		dataButton.setSelected(true);
		selectionPanel.add(dataButton);

		imageButton = new JRadioButton(i18n("imageCD"));
		selectionPanel.add(imageButton);

		audioButton = new JRadioButton(i18n("audioCD"));
		selectionPanel.add(audioButton);

		selectionPanel.add(new JLabel("?"));

		ButtonGroup group = new ButtonGroup();
		group.add(dataButton);
		group.add(imageButton);
		group.add(audioButton);

		getContentPane().add(
			selectionPanel,	BorderLayout.CENTER);

		JPanel panel = new JPanel();
		panel.setLayout(new FlowLayout());

		JButton ok = new JButton(i18n("OK"));
		ok.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {
				setVisible(false);
			}
		});
		panel.add(ok);
		getContentPane().add(panel, BorderLayout.SOUTH);
	}

	public int getResult()
	{
		if (dataButton.isSelected())
			return 0;
		else
		if (imageButton.isSelected())
			return 1;
		else
			return 2;
	}

	static String i18n(String str)
	{
		return CDcreator.i18n(str);
	}
}

