KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > tests > jfun > yan > xml > models > MyFruitEditor


1 package tests.jfun.yan.xml.models;
2
3 import java.beans.PropertyEditorSupport JavaDoc;
4
5 public class MyFruitEditor extends PropertyEditorSupport JavaDoc {
6
7   public Object JavaDoc getValue() {
8     // TODO Auto-generated method stub
9
return super.getValue();
10   }
11
12   public void setAsText(String JavaDoc text) throws IllegalArgumentException JavaDoc {
13     if(text.equals("apple")){
14       super.setValue(new Apple("apple editor"));
15     }
16     else if(text.equals("orange")){
17       super.setValue(new Orange("orange editor"));
18     }
19     else{
20       throw new IllegalArgumentException JavaDoc("unknown fruit");
21     }
22   }
23
24 }
25
Popular Tags