Debian Codegraph @

demos/src/main/java/com/ibm/icu/dev/demo/translit/InfoDialog.java

raw
1 // © 2016 and later: Unicode, Inc. and others.
2 // License & terms of use: http://www.unicode.org/copyright.html
3 /**
4 *******************************************************************************
5 * Copyright (C) 2001-2010, International Business Machines Corporation and *
6 * others. All Rights Reserved. *
7 *******************************************************************************
8 */
9 package com.ibm.icu.dev.demo.translit;
10 import java.awt.BorderLayout;
11 import java.awt.Button;
12 import java.awt.Dialog;
13 import java.awt.FlowLayout;
14 import java.awt.Frame;
15 import java.awt.Label;
16 import java.awt.Panel;
17 import java.awt.TextArea;
18 import java.awt.event.ActionEvent;
19 import java.awt.event.ActionListener;
20 import java.awt.event.WindowAdapter;
21 import java.awt.event.WindowEvent;
22 public 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 }