1 5 package net.sf.panoptes.swing.propeditors; 6 7 import javax.swing.JComponent ; 8 import javax.swing.JTextField ; 9 10 16 public class StringEditor extends JTextField implements PropertyEditor { 17 18 public StringEditor() { 19 super(); 20 } 21 22 public void setValue(Object value) { 23 if (!(value instanceof String )) throw new UnsupportedOperationException ("Only Strings allowed"); 24 setText(value.toString()); 25 } 26 27 public Object getValue() { 28 return getText(); 29 } 30 31 public JComponent getComponent() { 32 return this; 33 } 34 } 35 | Popular Tags |