class TimeFilteredDocument
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 |
|---|---|
static java.lang.String[] |
ALLOWED_CHARS |
static java.lang.String |
HOURS_FIRST_DIGITS |
static java.lang.String |
MINS_SECS_FIRST_DIGITS |
static java.lang.String |
TIME_DIGITS |
| Constructor and Description |
|---|
TimeFilteredDocument(TimeJTextField textField)
Constructs a plain text document.
|
TimeFilteredDocument(TimeJTextField textField,
int maxNumChars)
Deprecated.
maxNumChars is not used
|
| Modifier and Type | Method and Description |
|---|---|
TimeJTextField |
getTextField()
Gets the text field for this document.
|
protected int |
insertChar(int offs,
char ch)
Inserts a character into the document.
|
void |
insertString(int offs,
java.lang.String str,
javax.swing.text.AttributeSet aSet)
Inserts data into the document, filtering it along the way.
|
protected static boolean |
isValidChar(int offs,
char ch)
Determines if the character is valid for the specified position.
|
protected boolean |
isValidStr(int offs,
java.lang.String str)
Determines if the string is valid for the specified position.
|
void |
remove(int offs,
int len)
Removes some content from the document.
|
protected int |
removeChar(int offs)
Remove the character from the document.
|
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, removeDocumentListener, removeUndoableEditListener, render, replace, setAsynchronousLoadPriority, setDocumentFilter, setDocumentProperties, writeLock, writeUnlockpublic static final java.lang.String TIME_DIGITS
public static final java.lang.String HOURS_FIRST_DIGITS
public static final java.lang.String MINS_SECS_FIRST_DIGITS
public static final java.lang.String[] ALLOWED_CHARS
public TimeFilteredDocument(TimeJTextField textField)
textField - the text field for the document.public TimeFilteredDocument(TimeJTextField textField, int maxNumChars)
textField - the text field for the document.maxNumChars - the maximum number of characters.protected int insertChar(int offs,
char ch)
throws javax.swing.text.BadLocationException
offs - the offset.ch - the character to insert.javax.swing.text.BadLocationException - if the given position is not a
valid position within the document.protected static boolean isValidChar(int offs,
char ch)
offs - the offset.ch - the character to insert.protected boolean isValidStr(int offs,
java.lang.String str)
offs - the offset.str - the string to insert.protected int removeChar(int offs)
throws javax.swing.text.BadLocationException
offs - the offset.javax.swing.text.BadLocationException - if the given position is not a
valid position within the document.public TimeJTextField getTextField()
public void insertString(int offs,
java.lang.String str,
javax.swing.text.AttributeSet aSet)
throws javax.swing.text.BadLocationException
insertString in interface javax.swing.text.DocumentinsertString in class javax.swing.text.PlainDocumentoffs - the starting offset (greater than or equal to zero).str - 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 remove(int offs,
int len)
throws javax.swing.text.BadLocationException
remove in interface javax.swing.text.Documentremove in class javax.swing.text.AbstractDocumentoffs - the starting offset >= 0len - the number of characters to remove >= 0javax.swing.text.BadLocationException - the given remove position is not a valid
position within the document