    01: import java.awt.Component;
    02: import java.beans.PropertyEditorSupport;
    03: import javax.swing.JScrollPane;
    04: import javax.swing.JTextArea;
    05: import javax.swing.event.DocumentEvent;
    06: import javax.swing.event.DocumentListener;
    07: import javax.swing.text.Document;
    08:
    09: /**
    10:    A property editor for the MultiLineString type.
    11: */
    12: public class MultiLineStringEditor extends PropertyEditorSupport
    13: {
    14:    public boolean supportsCustomEditor()
    15:    {
    16:       return true;
    17:    }
    18:
    19:    public Component getCustomEditor()
    20:    {
    21:       final MultiLineString value = (MultiLineString) getValue();
    22:       final JTextArea textArea = new JTextArea(value.getText(),10, 40);
    23:       textArea.getDocument().addDocumentListener(new
    24:          DocumentListener()
    25:          {
    26:             public void insertUpdate(DocumentEvent e)
    27:             {
    28:                value.setText(textArea.getText());
    29:                firePropertyChange();
    30:             }
    31:             public void removeUpdate(DocumentEvent e)
    32:             {
    33:                value.setText(textArea.getText());
    34:                firePropertyChange();
    35:             }
    36:             public void changedUpdate(DocumentEvent e)
    37:             {
    38:             }
    39:          });
    40:       return new JScrollPane(textArea);
    41:    }
    42: }