/Users/lyon/j4p/src/sound/filterDesign/TimeFrame.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:   TimeFrame.java 
7     
8    import java.awt.*; 
9    import java.awt.event.*; 
10   import java.util.Vector; 
11    
12   public class TimeFrame extends Frame 
13           implements ActionListener, ItemListener { 
14    
15       public TimeFrame(TimeDomainBean timedomainbean) { 
16           super("Set Parameters"); 
17           setSize(550, 200); 
18           setResizable(false); 
19           setVisible(false); 
20           timeDomain = timedomainbean; 
21           thick = 1; 
22           setLayout(new GridBagLayout()); 
23           GridBagConstraints gridbagconstraints = new GridBagConstraints(); 
24           xMin = new Label("Minimum time ", 2); 
25           xMax = new Label("Maximum time ", 2); 
26           yMin = new Label("Minimum  ", 2); 
27           yMax = new Label("Maximum  ", 2); 
28           precise = new Label("Precision (1-300)  ", 2); 
29           gain = new Label("Gain  ", 2); 
30           Label label = new Label("Thickness : ", 2); 
31           error = 
32                   new Label( 
33                           "There are no errors for now but it could happen !!!", 
34                           1); 
35           minTime = new TextField(5); 
36           maxTime = new TextField(5); 
37           minimum = new TextField(5); 
38           maximum = new TextField(5); 
39           precision = new TextField(5); 
40           gainField = new TextField(5); 
41           epaisseur = new CheckboxGroup(); 
42           t1 = new Checkbox(" 1 ", true, epaisseur); 
43           t2 = new Checkbox(" 2 ", false, epaisseur); 
44           okButton = new Button("OK"); 
45           cancelButton = new Button("Cancel"); 
46           Panel panel = new Panel(); 
47           panel.setLayout(new GridLayout(3, 4)); 
48           panel.add(xMin); 
49           panel.add(minTime); 
50           panel.add(xMax); 
51           panel.add(maxTime); 
52           panel.add(yMin); 
53           panel.add(minimum); 
54           panel.add(yMax); 
55           panel.add(maximum); 
56           panel.add(precise); 
57           panel.add(precision); 
58           panel.add(gain); 
59           panel.add(gainField); 
60           gridbagconstraints.gridy = 0; 
61           add(panel, gridbagconstraints); 
62           Panel panel1 = new Panel(); 
63           panel1.add(okButton); 
64           panel1.add(cancelButton); 
65           Panel panel2 = new Panel(); 
66           panel2.add(label); 
67           panel2.add(t1); 
68           panel2.add(t2); 
69           gridbagconstraints.gridy = 1; 
70           add(panel2, gridbagconstraints); 
71           gridbagconstraints.gridy = 2; 
72           add(error, gridbagconstraints); 
73           gridbagconstraints.gridy = 3; 
74           add(panel1, gridbagconstraints); 
75           validate(); 
76           okButton.addActionListener(this); 
77           cancelButton.addActionListener(this); 
78           minTime.addActionListener(this); 
79           maxTime.addActionListener(this); 
80           minimum.addActionListener(this); 
81           maximum.addActionListener(this); 
82           precision.addActionListener(this); 
83           gainField.addActionListener(this); 
84           t1.addItemListener(this); 
85           t2.addItemListener(this); 
86           addWindowListener(new WindowAdapter() { 
87    
88               public void windowClosing(WindowEvent windowevent) { 
89                   setVisible(false); 
90               } 
91    
92           }); 
93           error.setText(""); 
94       } 
95    
96       public void wake() { 
97           para = timeDomain.newParams(); 
98           x1 = ((Double) para.elementAt(0)).doubleValue(); 
99           x2 = ((Double) para.elementAt(1)).doubleValue(); 
100          y1 = ((Double) para.elementAt(2)).doubleValue(); 
101          y2 = ((Double) para.elementAt(3)).doubleValue(); 
102          p = ((Integer) para.elementAt(4)).intValue(); 
103          g = ((Double) para.elementAt(5)).doubleValue(); 
104          minTime.setText(String.valueOf(x1)); 
105          maxTime.setText(String.valueOf(x2)); 
106          minimum.setText(String.valueOf(y1)); 
107          maximum.setText(String.valueOf(y2)); 
108          precision.setText(String.valueOf(p)); 
109          gainField.setText(String.valueOf(g)); 
110          error.setText( 
111                  "Still a big long enormous string, just because things are strange in this world"); 
112          setVisible(true); 
113          error.setText(""); 
114      } 
115   
116      public void actionPerformed(ActionEvent actionevent) { 
117          Object obj = actionevent.getSource(); 
118          if (obj == cancelButton) { 
119              setVisible(false); 
120              return; 
121          } 
122          try { 
123              x1 = (new Double(minTime.getText())).doubleValue(); 
124              x2 = (new Double(maxTime.getText())).doubleValue(); 
125              y1 = (new Double(minimum.getText())).doubleValue(); 
126              y2 = (new Double(maximum.getText())).doubleValue(); 
127              p = (new Integer(precision.getText())).intValue(); 
128              g = (new Double(gainField.getText())).doubleValue(); 
129              if (x1 >= x2 || 
130                      y1 >= y2 || 
131                      p < 1 || 
132                      p > 300 || 
133                      x1 < 0.0D || 
134                      x2 < 0.0D) { 
135                  throw new MyException("Please, insert correct values !!!"); 
136              } else { 
137                  para = new Vector(); 
138                  para.addElement(new Double(x1)); 
139                  para.addElement(new Double(x2)); 
140                  para.addElement(new Double(y1)); 
141                  para.addElement(new Double(y2)); 
142                  para.addElement(new Integer(p)); 
143                  para.addElement(new Double(g)); 
144                  para.addElement(new Integer(thick)); 
145                  error.setText(""); 
146                  timeDomain.oldParams(para); 
147                  setVisible(false); 
148                  return; 
149              } 
150          } catch (MyException myexception) { 
151              error.setText(myexception.getMessage()); 
152              return; 
153          } catch (NumberFormatException _ex) { 
154              error.setText( 
155                      "A number is something with digits (0..9), thanks."); 
156          } 
157      } 
158   
159      public void itemStateChanged(ItemEvent itemevent) { 
160          if (t1.getState()) { 
161              thick = 1; 
162              return; 
163          } else { 
164              thick = 2; 
165              return; 
166          } 
167      } 
168   
169      double x1; 
170      double x2; 
171      double y1; 
172      double y2; 
173      double g; 
174      int p; 
175      int thick; 
176      Label xMin; 
177      Label xMax; 
178      Label yMin; 
179      Label yMax; 
180      Label precise; 
181      Label gain; 
182      Label error; 
183      TextField minTime; 
184      TextField maxTime; 
185      TextField minimum; 
186      TextField maximum; 
187      TextField precision; 
188      TextField gainField; 
189      Button okButton; 
190      Button cancelButton; 
191      CheckboxGroup epaisseur; 
192      Checkbox t1; 
193      Checkbox t2; 
194      TimeDomainBean timeDomain; 
195      Vector para; 
196  } 
197