/Users/lyon/j4p/src/sound/filterDesign/AddRootBean.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:   AddRootBean.java 
7     
8    import java.awt.*; 
9    import java.awt.event.ActionEvent; 
10   import java.awt.event.ActionListener; 
11   import java.beans.PropertyChangeListener; 
12   import java.beans.PropertyChangeSupport; 
13   import java.io.Serializable; 
14   import java.util.Vector; 
15    
16   public class AddRootBean extends Panel 
17           implements Serializable, ActionListener { 
18    
19       public AddRootBean() { 
20           bodeListeners = new Vector(); 
21           pcs = new PropertyChangeSupport(this); 
22           input = new AddFrame(this); 
23           button = new Button("Add Pole/Zero"); 
24           setLayout(new BorderLayout()); 
25           add(button, "Center"); 
26           button.addActionListener(this); 
27       } 
28    
29       public void actionPerformed(ActionEvent actionevent) { 
30           input.wake(); 
31       } 
32    
33       public void newParams(Vector vector) { 
34           double d = ((Double) vector.elementAt(0)).doubleValue(); 
35           double d1 = ((Double) vector.elementAt(1)).doubleValue(); 
36           int i = ((Integer) vector.elementAt(2)).intValue(); 
37           if (i == 1) { 
38               fireBodeEvent(new BodeEvent(this, new Zero(d, d1), 1)); 
39               return; 
40           } else { 
41               fireBodeEvent(new BodeEvent(this, new Pole(d, d1), 0)); 
42               return; 
43           } 
44       } 
45    
46       public synchronized void addBodeListener(BodeListener bodelistener) { 
47           bodeListeners.addElement(bodelistener); 
48       } 
49    
50       public synchronized void removeBodeListener(BodeListener bodelistener) { 
51           bodeListeners.removeElement(bodelistener); 
52       } 
53    
54       public void fireBodeEvent(BodeEvent bodeevent) { 
55           Vector vector = null; 
56           synchronized (this) { 
57               vector = (Vector) bodeListeners.clone(); 
58           } 
59           for (int i = 0; i < vector.size(); i++) { 
60               BodeListener bodelistener = (BodeListener) vector.elementAt(i); 
61               bodelistener.changeOccured(bodeevent); 
62           } 
63    
64       } 
65    
66       public void addPropertyChangeListener( 
67               PropertyChangeListener propertychangelistener) { 
68           pcs.addPropertyChangeListener(propertychangelistener); 
69       } 
70    
71       public void removePropertyChangeListener( 
72               PropertyChangeListener propertychangelistener) { 
73           pcs.removePropertyChangeListener(propertychangelistener); 
74       } 
75    
76       public void setFontSize(int i) { 
77           Font font = getFont(); 
78           setFont(new Font(font.getName(), font.getStyle(), i)); 
79           pcs.firePropertyChange("fontSize", 
80                   new Integer(font.getSize()), 
81                   new Integer(i)); 
82       } 
83    
84       public void setFont(Font font) { 
85           Font font1 = getFont(); 
86           super.setFont(font); 
87           pcs.firePropertyChange("font", font1, font); 
88       } 
89    
90       public void setBackground(Color color) { 
91           Color color1 = getBackground(); 
92           super.setBackground(color); 
93           pcs.firePropertyChange("background", color1, color); 
94       } 
95    
96       public void setForeground(Color color) { 
97           Color color1 = getForeground(); 
98           super.setForeground(color); 
99           pcs.firePropertyChange("foreground", color1, color); 
100      } 
101   
102      public Dimension getMinimumSize() { 
103          return new Dimension(30, 20); 
104      } 
105   
106      AddFrame input; 
107      Button button; 
108      private Vector bodeListeners; 
109      private PropertyChangeSupport pcs; 
110  } 
111