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             * ID for serialization.
021             */
022            private static final long serialVersionUID = 8509695263285879744L;
023    
024            /**
025         * Create a new MsgForm. The &quot;{@link FormSheet#waitResponse}&quot; property will be set to true.
026         *
027         * @param sCaption the FormSheet's caption.
028         * @param sMsg the message to be displayed. It can contain '\n's which will be
029         * interpreted accordingly.
030         */
031        public MsgForm(String sCaption, String sMsg) {
032            this(sCaption, sMsg, true);
033        }
034    
035        /**
036         * Create a new MsgForm.
037         *
038         * @param sCaption the FormSheet's caption.
039         * @param sMsg the message to be displayed. It can contain '\n's which will be
040         * interpreted accordingly.
041         * @param fWaitResponse the initial value for the &quot;{@link FormSheet#waitResponse}&quot; property.
042         */
043        public MsgForm(String sCaption, final String sMsg, boolean fWaitResponse) {
044            super(sCaption, new FormSheetContentCreator() {
045                /**
046                             * ID for serialization.
047                             */
048                            private static final long serialVersionUID = -7690585415766451931L;
049    
050                            protected void createFormSheetContent(final FormSheet fs) {
051                    JTextArea jta = new JTextArea(sMsg);
052                    jta.setEditable(false);
053                    fs.setComponent(new JScrollPane(jta));
054    
055                    fs.removeButton(BTNID_CANCEL);
056                }
057            }
058    
059            , fWaitResponse);
060        }
061    
062    }