KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > netbeans > test > editor > app > core > properties > BooleanProperty


1 /*
2  * StringProperty.java
3  *
4  * Created on December 10, 2002, 5:50 PM
5  */

6
7 package org.netbeans.test.editor.app.core.properties;
8
9 /**
10  *
11  * @author eh103527
12  */

13 public class BooleanProperty implements Property {
14     
15     private static String JavaDoc[] VALUES = {Boolean.TRUE.toString(),Boolean.FALSE.toString()};
16     private boolean value = false;
17     
18     /** Creates a new instance of StringProperty */
19     public BooleanProperty(boolean value) {
20         this.value=value;
21     }
22     
23     public String JavaDoc getProperty() {
24         if (value) {
25             return VALUES[0];
26         } else {
27             return VALUES[1];
28         }
29     }
30     
31     public void setProperty(String JavaDoc value) {
32         if (Boolean.TRUE.toString().compareTo(value) != 0) {
33             this.value=true;
34         } else {
35             this.value=false;
36         }
37     }
38     
39     public String JavaDoc[] getValues() {
40         return VALUES;
41     }
42     
43     public boolean getValue() {
44         return value;
45     }
46     
47 }
48
Popular Tags