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 LabeledTextArea extends Panel {
  private Label label;
  private TextArea textArea;

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

  public TextArea getTextArea() {
    return(textArea);
  }

  public LabeledTextArea(String labelString,
			 int rows, int cols) {
    this(labelString, null, rows, cols, null, "");
  }

  public LabeledTextArea(String labelString,
			 Font labelFont,
			 int rows, int cols,
			 Font textAreaFont,
			 String textAreaString) {
    setLayout(new BorderLayout());
    label = new Label(labelString, Label.CENTER);
    if (labelFont != null)
      label.setFont(labelFont);
    add("North", label);
    textArea = new TextArea(textAreaString, rows, cols);
    if (textAreaFont != null)
      textArea.setFont(textAreaFont);
    add("Center", textArea);
  }
}

