/Users/lyon/j4p/src/sound/filterDesign/EditFrame.java
|
1 package sound.filterDesign;
2
3 // Decompiled by Jad v1.5.8c. Copyright 2001 Pavel Kouznetsov.
4 // Jad home page: http://www.geocities.com/kpdus/jad.html
5 // Decompiler options: packimports(3)
6 // Source File Name: EditFrame.java
7
8 import java.awt.*;
9 import java.awt.event.ActionEvent;
10 import java.awt.event.ActionListener;
11 import java.awt.event.WindowAdapter;
12 import java.awt.event.WindowEvent;
13 import java.util.Vector;
14
15 public class EditFrame extends Frame
16 implements ActionListener {
17
18 public EditFrame(SPlaneBean splanebean) {
19 super("Edit Pole/Zero");
20 setSize(300, 200);
21 setVisible(false);
22 source = splanebean;
23 setLayout(new GridBagLayout());
24 GridBagConstraints gridbagconstraints = new GridBagConstraints();
25 Real = new Label("Real : ", 2);
26 Imag = new Label("Imag : ", 2);
27 realTxt = new TextField(5);
28 imagTxt = new TextField(5);
29 poleButton = new Button("Add pole");
30 zeroButton = new Button("Add zero");
31 cancelButton = new Button("Cancel");
32 Panel panel = new Panel();
33 panel.add(Real);
34 panel.add(realTxt);
35 panel.add(Imag);
36 panel.add(imagTxt);
37 gridbagconstraints.gridy = 0;
38 add(panel, gridbagconstraints);
39 panel = new Panel();
40 panel.add(poleButton);
41 panel.add(zeroButton);
42 gridbagconstraints.gridy = 1;
43 add(panel, gridbagconstraints);
44 panel = new Panel();
45 panel.add(cancelButton);
46 gridbagconstraints.gridy = 2;
47 add(panel, gridbagconstraints);
48 validate();
49 poleButton.addActionListener(this);
50 zeroButton.addActionListener(this);
51 cancelButton.addActionListener(this);
52 realTxt.addActionListener(this);
53 imagTxt.addActionListener(this);
54 addWindowListener(new WindowAdapter() {
55
56 public void windowClosing(WindowEvent windowevent) {
57 setVisible(false);
58 }
59
60 });
61 }
62
63 public void wake() {
64 realTxt.setText("");
65 imagTxt.setText("");
66 setVisible(true);
67 }
68
69 public void actionPerformed(ActionEvent actionevent) {
70 Object obj = actionevent.getSource();
71 if (obj == cancelButton) {
72 setVisible(false);
73 return;
74 }
75 try {
76 real = (new Double(realTxt.getText())).doubleValue();
77 imag = (new Double(imagTxt.getText())).doubleValue();
78 params = new Vector();
79 params.addElement(new Double(real));
80 params.addElement(new Double(imag));
81 if (obj == poleButton)
82 params.addElement(new Integer(0));
83 else
84 params.addElement(new Integer(1));
85 source.newParams(params);
86 setVisible(false);
87 return;
88 } catch (NumberFormatException _ex) {
89 return;
90 }
91 }
92
93 double real;
94 double imag;
95 Label Real;
96 Label Imag;
97 TextField realTxt;
98 TextField imagTxt;
99 Button poleButton;
100 Button zeroButton;
101 Button cancelButton;
102 SPlaneBean source;
103 Vector params;
104 }
105