1 package tests.jfun.yan.xml.models; 2 3 import java.beans.PropertyEditorSupport ; 4 5 public class MyFruitEditor extends PropertyEditorSupport { 6 7 public Object getValue() { 8 return super.getValue(); 10 } 11 12 public void setAsText(String text) throws IllegalArgumentException { 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 ("unknown fruit"); 21 } 22 } 23 24 } 25 | Popular Tags |