KickJava   Java API By Example, From Geeks To Geeks.

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


1 /*
2  * ArrayProperty.java
3  *
4  * Created on November 25, 2002, 11:40 AM
5  */

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

13 public class ArrayProperty implements Property {
14     
15     private Object JavaDoc value;
16     
17     private Object JavaDoc[] values;
18     
19     /** Creates a new instance of ArrayProperty */
20     public ArrayProperty(Object JavaDoc val,Object JavaDoc[] vals) {
21         value=val;
22         values=vals;
23     }
24     
25     public String JavaDoc getProperty() {
26         return value.toString();
27     }
28     
29     public void setProperty(String JavaDoc value) {
30         boolean found=false;
31         for (int i=0;i < values.length;i++) {
32             if (values[i].toString().compareTo(value) == 0) {
33                 this.value=values[i];
34                 found=true;
35                 break;
36             }
37         }
38     }
39     
40     public Object JavaDoc[] getValues() {
41         return values;
42     }
43     
44     public Object JavaDoc getValue() {
45         return value;
46     }
47     
48 }
49
Popular Tags