Package com.gargoylesoftware.base.util
Class DocumentUtil
- java.lang.Object
-
- com.gargoylesoftware.base.util.DocumentUtil
-
public class DocumentUtil extends java.lang.ObjectVarious utility methods relating to documents.- Version:
- $Revision: 1.4 $
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description private static classDocumentUtil.LengthLimitedDocumentA wrapper document that prevents the user from typing more than a specified number of characters.private static classDocumentUtil.PassthroughDocumentA document that merely passes all requests through to another document.
-
Constructor Summary
Constructors Modifier Constructor Description privateDocumentUtil()Private constructor to prevent instantiation of this class.
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static javax.swing.text.DocumentlengthLimitedDocument(int maxLength)Return a PlainDocument wrappered so that it is length limited.static javax.swing.text.DocumentlengthLimitedDocument(javax.swing.text.Document document, int maxLength)Return a wrapper document that prevents the user from typing more than a specified number of characters.static javax.swing.text.DocumentupperCaseDocument()Return a PlainDocument wrappered so that it accepts uppercase input only.static javax.swing.text.DocumentupperCaseDocument(javax.swing.text.Document document)Return a wrapper document that converts all input to uppercase.
-
-
-
Method Detail
-
upperCaseDocument
public static javax.swing.text.Document upperCaseDocument(javax.swing.text.Document document)
Return a wrapper document that converts all input to uppercase.- Parameters:
document- The document to wrapper.- Returns:
- The new wrapper document.
-
upperCaseDocument
public static javax.swing.text.Document upperCaseDocument()
Return a PlainDocument wrappered so that it accepts uppercase input only.- Returns:
- The new wrapper document.
-
lengthLimitedDocument
public static javax.swing.text.Document lengthLimitedDocument(javax.swing.text.Document document, int maxLength)Return a wrapper document that prevents the user from typing more than a specified number of characters.- Parameters:
document- The document to wrapper.maxLength- The maximum number of characters that can be placed in this document.- Returns:
- The new wrapper document.
-
lengthLimitedDocument
public static javax.swing.text.Document lengthLimitedDocument(int maxLength)
Return a PlainDocument wrappered so that it is length limited.- Parameters:
maxLength- The maximum number of characters that can be placed in this document.- Returns:
- The new wrapper document.
-
-