FileDocCategorySizeDatePackage
YesNoPanelMessageEditor.javaAPI DocExample3288Sat Jan 24 10:44:38 GMT 2004je3.beans

YesNoPanelMessageEditor

public class YesNoPanelMessageEditor extends Object implements PropertyEditor
This class is a custom editor for the messageText property of the YesNoPanel bean. It is necessary because the default editor for properties of type String does not allow multi-line strings to be entered.

Fields Summary
protected String
value
protected PropertyChangeSupport
listeners
Constructors Summary
Methods Summary
public voidaddPropertyChangeListener(java.beans.PropertyChangeListener l)

        
	listeners.addPropertyChangeListener(l);
    
public java.lang.StringgetAsText()

 return value; 
public java.awt.ComponentgetCustomEditor()

	final JTextArea t = new JTextArea(value, 5, 30); // 5 rows, 30 cols
	t.getDocument().addDocumentListener(new DocumentListener() {
		public void insertUpdate(DocumentEvent e) { update(); }
		public void changedUpdate(DocumentEvent e) { update(); }
		public void removeUpdate(DocumentEvent e) { update(); }
		public void update() {
		    value = t.getText();
		    listeners.firePropertyChange(null, null, null);
		}
	    });

	return new JScrollPane(t);
    
public java.lang.StringgetJavaInitializationString()

 return "\"" + value + "\""; 
public java.lang.String[]getTags()

 return null; 
public java.lang.ObjectgetValue()

 return value; 
public booleanisPaintable()

 return true; 
public voidpaintValue(java.awt.Graphics g, java.awt.Rectangle r)

	g.setClip(r);
	g.drawString("Click to edit...", r.x+5, r.y+15);
    
public voidremovePropertyChangeListener(java.beans.PropertyChangeListener l)

	listeners.removePropertyChangeListener(l);
    
public voidsetAsText(java.lang.String s)

 value = s; 
public voidsetValue(java.lang.Object o)

  value = (String) o; 
public booleansupportsCustomEditor()

 return true;