import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import java.text.DecimalFormat;
import java.util.*;

/**
 * A wrapper class for JPanel creates a list of option
 */
public class OptionPanel extends JPanel implements ActionListener {
  
  private JToggleButton[] buttons;
  private Option[] options;
  private EggShop eggShop;
  
  /**
   * update the price whenever an option changes
   */
  public void actionPerformed(ActionEvent e) {
    //COMPLETE ME!
  }
  
  /**
   * Create a new OptionPanel
   * @param eggShop the window to which this panel is added
   * @param options an array of Options to be displayed
   * @param title the title for the panel
   * @param group if this is true, then the panel will contain a 
   * group of radio buttons.  if false, then it will contain check boxes.
   */
  OptionPanel(EggShop eggShop, Option[] options, String title, Boolean group) { 
    super();
    
    this.eggShop = eggShop;
    this.options = options;
    this.buttons = new JToggleButton[options.length];
    
    ButtonGroup buttonGroup = new ButtonGroup();
    
    this.setBorder(BorderFactory.createTitledBorder(title));
    setLayout(new GridLayout(0,1));
    
    //Convert the array of Options to an array of ToggleButtons
    //COMPLETE ME!
    
    if (group && options.length > 0) {
      buttons[0].setSelected(true);
    }
    
  }
  
  /**
   * Get the total price of all the options selected
   * @returns total price
   */
  public double getPrice() {
    //COMPLETE ME!
  }
  
}