    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(10, 40);
    23:       textArea.setText(value.getText());
    24:       textArea.getDocument().addDocumentListener(new
    25:          DocumentListener()
    26:          {
    27:             public void insertUpdate(DocumentEvent e)
    28:             {
    29:                value.setText(textArea.getText());
    30:                firePropertyChange();
    31:             }
    32:             public void removeUpdate(DocumentEvent e)
    33:             {
    34:                value.setText(textArea.getText());
    35:                firePropertyChange();
    36:             }
    37:             public void changedUpdate(DocumentEvent e)
    38:             {
    39:             }
    40:          });
    41:       return new JScrollPane(textArea);
    42:    }
    43: }