org.tbee.swing.text
Class DocumentFilterSize
java.lang.Object
javax.swing.text.DocumentFilter
org.tbee.swing.text.DocumentFilterSize
public class DocumentFilterSize
- extends DocumentFilter
Limit any text component to a maximum length
To use DocumentFilterSize, create an instance and then attach it to a document using the setDocumentFilter method defined in the AbstractDocument class.
((AbstractDocument)lJTextArea.getDocument()).setDocumentFilter(new DocumentFilterSize( 20 ));
Although it is possible to have documents that do not descend from AbstractDocument, by default Swing text components use AbstractDocument subclasses for their documents.
- Author:
- User
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
DocumentFilterSize
public DocumentFilterSize(int maxsize)
- Parameters:
maxsize -
DocumentFilterSize
public DocumentFilterSize(int maxsize,
boolean showPopup)
- Parameters:
maxsize - showPopup -
setMaxsize
public void setMaxsize(int maxsize)
- maxsize
getMaxsize
public int getMaxsize()
setShowPopup
public void setShowPopup(boolean showPopup)
- showPopup
getShowPopup
public boolean getShowPopup()
insertString
public void insertString(DocumentFilter.FilterBypass fb,
int offs,
String str,
AttributeSet a)
throws BadLocationException
- Overrides:
insertString in class DocumentFilter
- Throws:
BadLocationException
replace
public void replace(DocumentFilter.FilterBypass fb,
int offs,
int length,
String str,
AttributeSet a)
throws BadLocationException
- Overrides:
replace in class DocumentFilter
- Throws:
BadLocationException
Copyright © 2011 KnowledgePlaza. All Rights Reserved.