Module is.codion.swing.common.ui
Class SizedDocument
java.lang.Object
javax.swing.text.AbstractDocument
javax.swing.text.PlainDocument
is.codion.swing.common.ui.component.text.SizedDocument
- All Implemented Interfaces:
Serializable
,Document
A Document implementation which allows for setting the max text length and automatic conversion to upper or lower case.
For instances use the
sizedDocument()
or sizedDocument(int)
factory methods.- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class javax.swing.text.AbstractDocument
AbstractDocument.AbstractElement, AbstractDocument.AttributeContext, AbstractDocument.BranchElement, AbstractDocument.Content, AbstractDocument.DefaultDocumentEvent, AbstractDocument.ElementEdit, AbstractDocument.LeafElement
-
Field Summary
Fields inherited from class javax.swing.text.PlainDocument
lineLimitAttribute, tabSizeAttribute
Fields inherited from class javax.swing.text.AbstractDocument
BAD_LOCATION, BidiElementName, ContentElementName, ElementNameAttribute, listenerList, ParagraphElementName, SectionElementName
Fields inherited from interface javax.swing.text.Document
StreamDescriptionProperty, TitleProperty
-
Method Summary
Modifier and TypeMethodDescriptionint
void
setDocumentFilter
(DocumentFilter filter) void
setMaximumLength
(int maximumLength) static SizedDocument
static SizedDocument
sizedDocument
(int maximumLength) Methods inherited from class javax.swing.text.PlainDocument
createDefaultRoot, getDefaultRootElement, getParagraphElement, insertString, insertUpdate, removeUpdate
Methods inherited from class javax.swing.text.AbstractDocument
addDocumentListener, addUndoableEditListener, createBranchElement, createLeafElement, createPosition, dump, fireChangedUpdate, fireInsertUpdate, fireRemoveUpdate, fireUndoableEditUpdate, getAsynchronousLoadPriority, getAttributeContext, getBidiRootElement, getContent, getCurrentWriter, getDocumentListeners, getDocumentProperties, getEndPosition, getLength, getListeners, getProperty, getRootElements, getStartPosition, getText, getText, getUndoableEditListeners, postRemoveUpdate, putProperty, readLock, readUnlock, remove, removeDocumentListener, removeUndoableEditListener, render, replace, setAsynchronousLoadPriority, setDocumentProperties, writeLock, writeUnlock
-
Method Details
-
setDocumentFilter
- Overrides:
setDocumentFilter
in classAbstractDocument
- Parameters:
filter
- the filter- Throws:
UnsupportedOperationException
- always
-
getDocumentFilter
- Overrides:
getDocumentFilter
in classAbstractDocument
-
getMaximumLength
public int getMaximumLength()- Returns:
- the maximum length of the text to allow, -1 if unlimited
-
setMaximumLength
public void setMaximumLength(int maximumLength) - Parameters:
maximumLength
- the maximum length of the text to allow, -1 if unlimited
-
sizedDocument
- Returns:
- a new
SizedDocument
-
sizedDocument
- Parameters:
maximumLength
- the maximum text length- Returns:
- a new
SizedDocument
-