001    package sale.stdforms;
002    
003    import sale.*;
004    
005    import javax.swing.*;
006    
007    /**
008     * A simple message FormSheet that will display a message in a JTextArea surrounded by
009     * a JScrollPane.
010     *
011     * <p>MsgForms use a {@link sale.FormSheetContentCreator} to create the FormSheet's contents.</p>
012     *
013     * @author Steffen Zschaler
014     * @version 2.0 21/05/1999
015     * @since v2.0
016     */
017    public class MsgForm extends FormSheet {
018    
019        /**
020         * Create a new MsgForm. The "{@link FormSheet#waitResponse}" property will be set to true.
021         *
022         * @param sCaption the FormSheet's caption.
023         * @param sMsg the message to be displayed. It can contain '\n's which will be
024         * interpreted accordingly.
025         */
026        public MsgForm(String sCaption, String sMsg) {
027            this(sCaption, sMsg, true);
028        }
029    
030        /**
031         * Create a new MsgForm.
032         *
033         * @param sCaption the FormSheet's caption.
034         * @param sMsg the message to be displayed. It can contain '\n's which will be
035         * interpreted accordingly.
036         * @param fWaitResponse, the initial value for the "{@link FormSheet#waitResponse}" property.
037         */
038        public MsgForm(String sCaption, final String sMsg, boolean fWaitResponse) {
039            super(sCaption, new FormSheetContentCreator() {
040                protected void createFormSheetContent(final FormSheet fs) {
041                    JTextArea jta = new JTextArea(sMsg);
042                    jta.setEditable(false);
043                    fs.setComponent(new JScrollPane(jta));
044    
045                    fs.removeButton(BTNID_CANCEL);
046                }
047            }
048    
049            , fWaitResponse);
050        }
051    
052    }