public class DocumentAdapter extends Object implements ChangeListener, DocumentListener
A null value of the ValueModel is preserved until the document changes. Note the following mapping:
Constructor and Description |
---|
DocumentAdapter(ValueModel<String> pValueModel,
Document pDocument)
Creates a new adapter between a ValueModel and a Document.
|
DocumentAdapter(ValueModel<String> pValueModel,
JTextComponent pTextField)
Creates a new adapter between a ValueModel and the Document of a
JTextComponent.
|
Modifier and Type | Method and Description |
---|---|
void |
changedUpdate(DocumentEvent pEvent) |
JTextComponent |
getTextComponent()
Return the text component we are adapting.
|
void |
insertUpdate(DocumentEvent pEvent) |
void |
removeUpdate(DocumentEvent pEvent) |
void |
stateChanged(ChangeEvent pEvent) |
public DocumentAdapter(ValueModel<String> pValueModel, JTextComponent pTextField)
pValueModel
- the value modelpTextField
- text field we take the document model fromIllegalArgumentException
- if pValueModel or pTextField are nullpublic DocumentAdapter(ValueModel<String> pValueModel, Document pDocument)
pValueModel
- the value modelpDocument
- the document modelIllegalArgumentException
- if pValueModel or pDocument are nullpublic JTextComponent getTextComponent()
public void stateChanged(ChangeEvent pEvent)
stateChanged
in interface ChangeListener
public void insertUpdate(DocumentEvent pEvent)
insertUpdate
in interface DocumentListener
public void removeUpdate(DocumentEvent pEvent)
removeUpdate
in interface DocumentListener
public void changedUpdate(DocumentEvent pEvent)
changedUpdate
in interface DocumentListener
Copyright © 2017 Jürgen Zeller (privat). All rights reserved.