2 * (C) Copyright IBM Corp. 1998-2007. All Rights Reserved.
\r
4 * The program is provided "as is" without any warranty express or
\r
5 * implied, including the warranty of non-infringement and the implied
\r
6 * warranties of merchantibility and fitness for a particular purpose.
\r
7 * IBM will not be liable for any damages suffered by you as a result
\r
8 * of using the Program. In no event will IBM be liable for any
\r
9 * special, indirect or consequential damages or lost profits even if
\r
10 * IBM has been advised of the possibility of their occurrence. IBM
\r
11 * will not be liable for any third party claims against you.
\r
13 package com.ibm.richtext.swingui;
\r
15 import java.awt.Color;
\r
16 import java.awt.Container;
\r
17 import java.awt.CardLayout;
\r
19 import javax.swing.JFrame;
\r
21 import java.awt.event.WindowAdapter;
\r
22 import java.awt.event.WindowEvent;
\r
24 import com.ibm.richtext.styledtext.MConstText;
\r
26 import com.ibm.richtext.textpanel.JTextPanel;
\r
27 import com.ibm.richtext.textpanel.TextPanelSettings;
\r
30 * MessageDialog is a simple Frame which displays a styled
\r
31 * text message in a TextPanel.
\r
32 * The text in the message is not selectable or editable.
\r
36 public final class JMessageDialog extends JFrame {
\r
41 private static final long serialVersionUID = 5012952859760456427L;
\r
43 //static final String COPYRIGHT =
\r
44 // "(C) Copyright IBM Corp. 1998-1999 - All Rights Reserved";
\r
46 * Create a new MessageDialog.
\r
47 * @param title the dialog's title
\r
48 * @param message the text which will appear in the dialog
\r
50 public JMessageDialog(String title, MConstText message)
\r
54 Container content = getContentPane();
\r
55 content.setLayout(new CardLayout());
\r
56 TextPanelSettings settings = JTextPanel.getDefaultSettings();
\r
57 settings.setScrollable(false);
\r
58 settings.setSelectable(false);
\r
59 JTextPanel panel = new JTextPanel(settings, message, null);
\r
61 panel.setBackground(Color.black);
\r
62 content.add("Center", panel);
\r
64 addWindowListener(new WindowAdapter() {
\r
65 public void windowClosing(WindowEvent e) {
\r