Package com.datasquad.task
Class JTextFieldLimit
- java.lang.Object
-
- javax.swing.text.AbstractDocument
-
- javax.swing.text.PlainDocument
-
- com.datasquad.task.JTextFieldLimit
-
- All Implemented Interfaces:
java.io.Serializable,javax.swing.text.Document
class JTextFieldLimit extends javax.swing.text.PlainDocumentThis class is used in order to check if the user doesn't type a lot of content in the inputs. For this we use the heritage of PlainDocument- Author:
- CADOUL Michael AND VERY-GRIETTE Milan
- See Also:
PlainDocument
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class javax.swing.text.AbstractDocument
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
-
-
Field Summary
Fields Modifier and Type Field Description private intlimit
-
Constructor Summary
Constructors Constructor Description JTextFieldLimit(int limit)Constructor with a specify number of character
-
Method Summary
Modifier and Type Method Description voidinsertString(int offset, java.lang.String str, javax.swing.text.AttributeSet attr)Check if the document don't exceed the limit of characters.-
Methods inherited from class javax.swing.text.PlainDocument
createDefaultRoot, getDefaultRootElement, getParagraphElement, 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, 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, writeUnlock
-
-
-
-
Method Detail
-
insertString
public void insertString(int offset, java.lang.String str, javax.swing.text.AttributeSet attr) throws javax.swing.text.BadLocationExceptionCheck if the document don't exceed the limit of characters.- Specified by:
insertStringin interfacejavax.swing.text.Document- Overrides:
insertStringin classjavax.swing.text.PlainDocument- Throws:
javax.swing.text.BadLocationException- Exception
-
-