import java.awt.*;

// This appears in Core Web Programming from
// Prentice Hall Publishers, and may be freely used
// or adapted. 1997 Marty Hall, hall@apl.jhu.edu.

public class LabeledChoice extends Panel {
  private Label label;
  private Choice choice;

  public Label getLabel() {
    return(label);
  }

  public Choice getChoice() {
    return(choice);
  }

  public LabeledChoice(String labelString,
		       String[] choices) {
    this(labelString, null, choices, null);
  }
  
  public LabeledChoice(String labelString,
		       Font labelFont,
		       String[] choices,
		       Font choiceFont) {
    setLayout(new FlowLayout(FlowLayout.LEFT));
    label = new Label(labelString, Label.RIGHT);
    if (labelFont != null)
      label.setFont(labelFont);
    add(label);
    choice = new Choice();
    if (choiceFont != null)
      choice.setFont(choiceFont);
    for(int i=0; i<choices.length; i++)
      choice.addItem(choices[i]);
    add(choice);
  }
}

