package guiDomain;

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

public class ColorItemPanel extends JPanel
{

    private JComboBox colorBox;
    /** The names of colors that appear in the combo box */
    private String[] colorNames;

    public ColorItemPanel(String name, String[] cNames)
    {
        colorNames = cNames;

	setLayout(new GridLayout(1,2));
	colorBox = new JComboBox(colorNames);

	add(new JLabel(name,SwingConstants.CENTER));
	add(colorBox);
    }

	/**
		Sets the selected item in the combo box
	*/
    public void setSelected(int i)
    {
		colorBox.setSelectedIndex(i);
    }

	/**
		Gets the selected item in the combo box
	*/
    public int getSelected()
    {
	    return colorBox.getSelectedIndex();
    }
}
