KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > more_for_test > TestBean


1 /*
2  * Sun Public License Notice
3  *
4  * The contents of this file are subject to the Sun Public License
5  * Version 1.0 (the "License"). You may not use this file except in
6  * compliance with the License. A copy of the License is available at
7  * http://www.sun.com/
8  *
9  * The Original Code is NetBeans. The Initial Developer of the Original
10  * Code is Sun Microsystems, Inc. Portions Copyright 1997-2002 Sun
11  * Microsystems, Inc. All Rights Reserved.
12  */

13
14 package more_for_test;
15
16 import java.beans.*;
17
18 /**
19  *
20  * @author pj97932
21  */

22 public class TestBean extends Object JavaDoc implements java.io.Serializable JavaDoc {
23     
24     private static final String JavaDoc PROP_SAMPLE_PROPERTY = "SampleProperty";
25     
26     private String JavaDoc sampleProperty;
27     
28     private PropertyChangeSupport propertySupport;
29     
30     /** Creates new TestBean */
31     public TestBean() {
32         propertySupport = new PropertyChangeSupport( this );
33     }
34     
35     public String JavaDoc getSampleProperty() {
36         return sampleProperty;
37     }
38     
39     public void setSampleProperty(String JavaDoc value) {
40         String JavaDoc oldValue = sampleProperty;
41         sampleProperty = value;
42         propertySupport.firePropertyChange(PROP_SAMPLE_PROPERTY, oldValue, sampleProperty);
43     }
44     
45     
46     public void addPropertyChangeListener(PropertyChangeListener listener) {
47         propertySupport.addPropertyChangeListener(listener);
48     }
49     
50     public void removePropertyChangeListener(PropertyChangeListener listener) {
51         propertySupport.removePropertyChangeListener(listener);
52     }
53     
54 }
55
Popular Tags