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