package sale.stdforms;

import sale.*;

import javax.swing.*;

/**
  * A simple message FormSheet that will display a message in a JTextArea surrounded by
  * a JScrollPane.
  *
  * <p>MsgForms use a {@link sale.FormSheetContentCreator} to create the FormSheet's contents.</p>
  *
  * @author Steffen Zschaler
  * @version 2.0 21/05/1999
  * @since v2.0
  */
public class MsgForm extends FormSheet {

  /**
    * Create a new MsgForm. The &quot;{@link FormSheet#waitResponse}&quot; property will be set to true.
    *
    * @param sCaption the FormSheet's caption.
    * @param sMsg the message to be displayed. It can contain '\n's which will be
    * interpreted accordingly.
    */
  public MsgForm (String sCaption, String sMsg) {
    this (sCaption, sMsg, true);
  }

  /**
    * Create a new MsgForm.
    *
    * @param sCaption the FormSheet's caption.
    * @param sMsg the message to be displayed. It can contain '\n's which will be
    * interpreted accordingly.
    * @param fWaitResponse, the initial value for the &quot;{@link FormSheet#waitResponse}&quot; property.
    */
  public MsgForm (String sCaption, final String sMsg, boolean fWaitResponse) {
    super (sCaption,
           new FormSheetContentCreator() {
             protected void createFormSheetContent (final FormSheet fs) {
               JTextArea jta = new JTextArea (sMsg);
               jta.setEditable (false);
               fs.setComponent (new JScrollPane (jta));

               fs.removeButton (BTNID_CANCEL);
             }
           },
           fWaitResponse);
  }

}