class FilteredDocument
extends javax.swing.text.PlainDocument
javax.swing.text.AbstractDocument.AbstractElement, javax.swing.text.AbstractDocument.AttributeContext, javax.swing.text.AbstractDocument.BranchElement, javax.swing.text.AbstractDocument.Content, javax.swing.text.AbstractDocument.DefaultDocumentEvent, javax.swing.text.AbstractDocument.ElementEdit, javax.swing.text.AbstractDocument.LeafElement| Modifier and Type | Field and Description |
|---|---|
boolean |
allowFlag |
int |
maxNumChars |
boolean |
numericFlag |
java.lang.String |
specialChars |
| Constructor and Description |
|---|
FilteredDocument(java.lang.String allowedChars,
boolean numericFlag,
int maxNumChars)
Constructs a plain text document.
|
FilteredDocument(java.lang.String specialChars,
boolean numericFlag,
int maxNumChars,
boolean allowFlag)
Constructs a plain text document.
|
| Modifier and Type | Method and Description |
|---|---|
java.lang.Comparable |
getMaxValueObj()
Returns the maximum value to be allowed for numeric entries, or
null if no value has been entered.
|
void |
insertString(int insOffs,
java.lang.String insStr,
javax.swing.text.AttributeSet aSet)
Inserts data into the document, filtering it along the way.
|
void |
setMaxValueObj(java.lang.Comparable obj)
Sets a maximum value to be allowed for numeric entries (only
used if the 'numericFlag' is true).
|
createDefaultRoot, getDefaultRootElement, getParagraphElement, insertUpdate, removeUpdateaddDocumentListener, addUndoableEditListener, createBranchElement, createLeafElement, createPosition, dump, fireChangedUpdate, fireInsertUpdate, fireRemoveUpdate, fireUndoableEditUpdate, getAsynchronousLoadPriority, getAttributeContext, getBidiRootElement, getContent, getCurrentWriter, getDocumentFilter, getDocumentListeners, getDocumentProperties, getEndPosition, getLength, getListeners, getProperty, getRootElements, getStartPosition, getText, getText, getUndoableEditListeners, postRemoveUpdate, putProperty, readLock, readUnlock, remove, removeDocumentListener, removeUndoableEditListener, render, replace, setAsynchronousLoadPriority, setDocumentFilter, setDocumentProperties, writeLock, writeUnlockpublic final java.lang.String specialChars
public final boolean numericFlag
public final int maxNumChars
public final boolean allowFlag
public FilteredDocument(java.lang.String allowedChars,
boolean numericFlag,
int maxNumChars)
allowedChars - a String of characters allowed to be entered
into the document.numericFlag - true for valid numeric onlymaxNumChars - maximum number of chars allowedpublic FilteredDocument(java.lang.String specialChars,
boolean numericFlag,
int maxNumChars,
boolean allowFlag)
specialChars - a String of characters allowed (or not)
into the document.numericFlag - true for valid numeric onlymaxNumChars - maximum number of chars allowedallowFlag - true to allow only the special characters, false to not
allow the special characters.public void insertString(int insOffs,
java.lang.String insStr,
javax.swing.text.AttributeSet aSet)
throws javax.swing.text.BadLocationException
insertString in interface javax.swing.text.DocumentinsertString in class javax.swing.text.PlainDocumentinsOffs - the starting offset (greater than or equal to zero).insStr - the string to insert (empty and null strings are
ignored).aSet - the attributes for the inserted content.javax.swing.text.BadLocationException - if the given position is not a
valid position within the document.public void setMaxValueObj(java.lang.Comparable obj)
obj - a "maximum" value object that implements the
'Comparable' interface (or null for no maximum).public java.lang.Comparable getMaxValueObj()