01: /*
02: *******************************************************************************
03: * Copyright (C) 1996-2004, International Business Machines Corporation and *
04: * others. All Rights Reserved. *
05: *******************************************************************************
06: */
07: package com.ibm.icu.dev.demo.translit;
08:
09: import java.awt.*;
10: import java.awt.event.*;
11: import java.applet.*;
12: import com.ibm.icu.dev.demo.impl.AppletFrame;
13:
14: /**
15: * A simple Applet that shows a button. When pressed, the button
16: * shows the DemoAppletFrame. This Applet is meant to be embedded
17: * in a web page.
18: *
19: * <p>Copyright (c) IBM Corporation 1999. All rights reserved.
20: *
21: * @author Alan Liu
22: */
23: public class DemoApplet extends Applet {
24:
25: Demo frame = null;
26:
27: private static final String COPYRIGHT = "\u00A9 IBM Corporation 1999. All rights reserved.";
28:
29: public static void main(String args[]) {
30: final DemoApplet applet = new DemoApplet();
31: new AppletFrame("Transliteration Demo", applet, 640, 480);
32: }
33:
34: public void init() {
35:
36: Button button = new Button("Transliteration Demo");
37: button.addActionListener(new ActionListener() {
38: public void actionPerformed(ActionEvent e) {
39: if (frame == null) {
40: frame = new Demo(600, 200);
41: frame.addWindowListener(new WindowAdapter() {
42: public void windowClosing(WindowEvent we) {
43: frame = null;
44: }
45: });
46: }
47: frame.setVisible(true);
48: frame.toFront();
49: }
50: });
51:
52: add(button);
53:
54: Dimension size = button.getPreferredSize();
55: size.width += 10;
56: size.height += 10;
57:
58: resize(size);
59: }
60:
61: public void stop() {
62: if (frame != null) {
63: frame.dispose();
64: }
65: frame = null;
66: }
67: }
|