1 /*
2 * StringEditor.java
3 *
4 * Created on 09 February 2001, 22:21
5 */
6
7 package org.johndavidtaylor.beans.beanpeeler;
8
9 /***
10 *
11 * @author Default
12 */
13 public class StringEditor extends java.awt.TextField implements GEditor, java.awt.event.FocusListener {
14 private java.beans.PropertyEditor pe;
15 private BeanPeeler bp;
16 /*** Creates new StringEditor */
17 public StringEditor(java.beans.PropertyEditor pe, BeanPeeler bp) {
18 this.pe = pe;
19 this.bp = bp;
20 this.addFocusListener(this);
21 this.setText(pe.getAsText());
22 }
23
24
25 public void focusGained(java.awt.event.FocusEvent p1) {
26 this.setText(pe.getAsText());
27 }
28
29 public void focusLost(java.awt.event.FocusEvent p1) {
30 try {
31 pe.setAsText(this.getText());
32 //System.out.println("setting(F) " + this.getText());
33 }
34 catch (Exception nf) {
35 this.setText(pe.getAsText());
36 bp.warn("Couldn't set property");
37 }
38 }
39
40 public void refresh() {
41 this.setText(pe.getAsText());
42 }
43
44 }
This page was automatically generated by Maven