/Users/lyon/j4p/src/ip/apurva/AnimateFrame.java
|
1 package ip.apurva;
2
3 import ip.gui.ImageSequence;
4
5 import java.awt.Button;
6 import java.awt.Frame;
7 import java.awt.GridLayout;
8 import java.awt.Panel;
9 import java.awt.event.ActionEvent;
10 import java.awt.event.ActionListener;
11 import java.awt.event.WindowEvent;
12 import java.awt.event.WindowListener;
13
14
15 public class AnimateFrame extends Frame
16 implements WindowListener,
17 ActionListener {
18 ip.gui.frames.AnimateFrame af
19 = new ip.gui.frames.AnimateFrame();
20 Panel p = new Panel();
21 Button savebutt = new Button("Save");
22 Button openbutt = new Button("Open");
23
24 ImageSequence IS = new ImageSequence();
25 ////////////////////////////////////////////////////
26 //methods for windowlistener
27 public void windowClosing(WindowEvent e) {
28 dispose();
29 }
30
31 public void windowClosed(WindowEvent e) {
32 };
33 public void windowDeiconified(WindowEvent e) {
34 };
35 public void windowIconified(WindowEvent e) {
36 };
37 public void windowActivated(WindowEvent e) {
38 };
39
40 public void windowDeactivated(WindowEvent e) {
41 };
42 public void windowOpened(WindowEvent e) {
43 };
44
45 ////////////////////////////////////////////////////
46 public void actionPerformed(ActionEvent e) {
47 Button b = (Button) e.getSource();
48 if (b == savebutt) {
49 af.saveImages();
50 return;
51 } else if (b == openbutt) {
52 ip.gui.frames.AnimateFrame ax = new ip.gui.frames.AnimateFrame();
53 ax.openImages();
54 ax.setRunning(true);
55 ax.setVisible(true);
56 return;
57 }
58 }
59 ////////////////////////////////////////////////////
60 public void init() {
61 add(p);
62 p.add(savebutt);
63 p.add(openbutt);
64 p.setLayout(new GridLayout(0, 2));
65 this.setLayout(new GridLayout(0, 1));
66 addWindowListener(this);
67 savebutt.addActionListener(this);
68 openbutt.addActionListener(this);
69 }
70
71 public AnimateFrame(
72 ip.gui.frames.AnimateFrame ax) {
73 super("gz frame");
74 init();
75 af = ax;
76 setSize(200, 200);
77 setVisible(true);
78 show();
79
80 }
81
82 public static void main(String args[]) {
83 new AnimateFrame(
84 new ip.gui.frames.AnimateFrame());
85 }
86 }
87