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