]> gitweb.fperrin.net Git - Dictionary.git/blob - jars/icu4j-4_4_2-src/demos/src/com/ibm/icu/dev/demo/translit/InfoDialog.java
go
[Dictionary.git] / jars / icu4j-4_4_2-src / demos / src / com / ibm / icu / dev / demo / translit / InfoDialog.java
1 /**\r
2  *******************************************************************************\r
3  * Copyright (C) 2001-2010, International Business Machines Corporation and    *\r
4  * others. All Rights Reserved.                                                *\r
5  *******************************************************************************\r
6  */\r
7 package com.ibm.icu.dev.demo.translit;\r
8 import java.awt.BorderLayout;\r
9 import java.awt.Button;\r
10 import java.awt.Dialog;\r
11 import java.awt.FlowLayout;\r
12 import java.awt.Frame;\r
13 import java.awt.Label;\r
14 import java.awt.Panel;\r
15 import java.awt.TextArea;\r
16 import java.awt.event.ActionEvent;\r
17 import java.awt.event.ActionListener;\r
18 import java.awt.event.WindowAdapter;\r
19 import java.awt.event.WindowEvent;\r
20 public class InfoDialog extends Dialog {\r
21     /**\r
22      * For serialization\r
23      */\r
24     private static final long serialVersionUID = -3086665546137919018L;\r
25     protected Button button;\r
26     protected TextArea area;\r
27     protected Dialog me;\r
28     protected Panel bottom;\r
29         \r
30     public TextArea getArea() {\r
31         return area;\r
32     }\r
33         \r
34     public Panel getBottom() {\r
35         return bottom;\r
36     }\r
37         \r
38     InfoDialog(Frame parent, String title, String label, String message) {\r
39         super(parent, title, false);\r
40         me = this;\r
41         this.setLayout(new BorderLayout());\r
42         if (label.length() != 0) {\r
43             this.add("North", new Label(label));\r
44         }\r
45             \r
46         area = new TextArea(message, 8, 80, TextArea.SCROLLBARS_VERTICAL_ONLY);\r
47         this.add("Center", area);\r
48             \r
49         button = new Button("Hide");\r
50         button.addActionListener(new ActionListener() {\r
51             public void actionPerformed(ActionEvent e) {\r
52                 me.hide();\r
53             }\r
54         });\r
55         bottom = new Panel();\r
56         bottom.setLayout(new FlowLayout(FlowLayout.CENTER, 0, 0));\r
57         bottom.add(button);\r
58         this.add("South", bottom);\r
59         this.pack();\r
60         addWindowListener(new WindowAdapter() {\r
61             public void windowClosing(WindowEvent e) {\r
62                 me.hide();\r
63             }\r
64         });\r
65     }\r
66 }\r