/Users/lyon/j4p/src/sound/filterDesign/SPlaneFrame.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:   SPlaneFrame.java 
7     
8    import java.awt.*; 
9    import java.awt.event.*; 
10   import java.util.Vector; 
11    
12   public class SPlaneFrame extends Frame 
13           implements ActionListener, ItemListener { 
14    
15       public static void main(String[] args) { 
16           System.out.println("thanks moo!"); 
17       } 
18    
19       public SPlaneFrame(SPlaneBean splanebean) { 
20           super("Set Parameters"); 
21           setSize(300, 200); 
22           setResizable(false); 
23           setVisible(false); 
24           sPlane = splanebean; 
25           thickness = 1; 
26           setLayout(new GridBagLayout()); 
27           GridBagConstraints gridbagconstraints = new GridBagConstraints(); 
28           xMax = new Label("X axis ", 2); 
29           yMax = new Label("Y axis ", 2); 
30           thick = new Label("Thickness : ", 2); 
31           error = 
32                   new Label( 
33                           "There are no errors for now but it could happen !!!", 
34                           1); 
35           maxX = new TextField(5); 
36           maxY = new TextField(5); 
37           Ness = new TextField(5); 
38           epaisseur = new CheckboxGroup(); 
39           t1 = new Checkbox(" 1 ", true, epaisseur); 
40           t2 = new Checkbox(" 2 ", false, epaisseur); 
41           okButton = new Button("OK"); 
42           cancelButton = new Button("Cancel"); 
43           Panel panel = new Panel(); 
44           panel.setLayout(new GridLayout(1, 4)); 
45           panel.add(xMax); 
46           panel.add(maxX); 
47           panel.add(yMax); 
48           panel.add(maxY); 
49           gridbagconstraints.gridy = 0; 
50           add(panel, gridbagconstraints); 
51           Panel panel1 = new Panel(); 
52           panel1.add(thick); 
53           panel1.add(t1); 
54           panel1.add(t2); 
55           gridbagconstraints.gridy = 1; 
56           add(panel1, gridbagconstraints); 
57           Panel panel2 = new Panel(); 
58           panel2.add(okButton); 
59           panel2.add(cancelButton); 
60           gridbagconstraints.gridy = 2; 
61           add(error, gridbagconstraints); 
62           gridbagconstraints.gridy = 3; 
63           add(panel2, gridbagconstraints); 
64           validate(); 
65           okButton.addActionListener(this); 
66           cancelButton.addActionListener(this); 
67           maxX.addActionListener(this); 
68           maxY.addActionListener(this); 
69           t1.addItemListener(this); 
70           t2.addItemListener(this); 
71           addWindowListener(new WindowAdapter() { 
72    
73               public void windowClosing(WindowEvent windowevent) { 
74                   setVisible(false); 
75               } 
76    
77           }); 
78           error.setText(""); 
79       } 
80    
81       public void wake() { 
82           para = sPlane.oldParams(); 
83           xmax = ((Double) para.elementAt(0)).doubleValue(); 
84           ymax = ((Double) para.elementAt(1)).doubleValue(); 
85           maxX.setText(String.valueOf(xmax)); 
86           maxY.setText(String.valueOf(ymax)); 
87           error.setText( 
88                   "Still a big long enormous string, just because things are strange in this world"); 
89           setVisible(true); 
90           error.setText(""); 
91       } 
92    
93       public void actionPerformed(ActionEvent actionevent) { 
94           Object obj = actionevent.getSource(); 
95           if (obj == cancelButton) { 
96               setVisible(false); 
97               return; 
98           } 
99           try { 
100              xmax = (new Double(maxX.getText())).doubleValue(); 
101              ymax = (new Double(maxY.getText())).doubleValue(); 
102              if (xmax <= 0.0D || ymax <= 0.0D) { 
103                  throw new MyException("Please, insert correct values !!!"); 
104              } else { 
105                  para = new Vector(); 
106                  para.addElement(new Double(xmax)); 
107                  para.addElement(new Double(ymax)); 
108                  para.addElement(new Integer(thickness)); 
109                  error.setText(""); 
110                  sPlane.newParams(para); 
111                  setVisible(false); 
112                  return; 
113              } 
114          } catch (MyException myexception) { 
115              error.setText(myexception.getMessage()); 
116              return; 
117          } catch (NumberFormatException _ex) { 
118              error.setText( 
119                      "A number is something with digits (0..9), thanks."); 
120          } 
121      } 
122   
123      public void itemStateChanged(ItemEvent itemevent) { 
124          if (t1.getState()) { 
125              thickness = 1; 
126              return; 
127          } else { 
128              thickness = 2; 
129              return; 
130          } 
131      } 
132   
133      double xmax; 
134      double ymax; 
135      int thickness; 
136      Label xMax; 
137      Label yMax; 
138      Label thick; 
139      Label error; 
140      TextField maxX; 
141      TextField maxY; 
142      TextField Ness; 
143      CheckboxGroup epaisseur; 
144      Checkbox t1; 
145      Checkbox t2; 
146      Button okButton; 
147      Button cancelButton; 
148      SPlaneBean sPlane; 
149      Vector para; 
150  } 
151