org.jtheque.utils.ui
Class DocumentLengthFilterAvert

java.lang.Object
  extended by javax.swing.text.DocumentFilter
      extended by org.jtheque.utils.ui.DocumentLengthFilter
          extended by org.jtheque.utils.ui.DocumentLengthFilterAvert

public final class DocumentLengthFilterAvert
extends DocumentLengthFilter

A document filter used to limit the length of a field. This filter avert the user with a popup when he go to the limit.

Author:
Baptiste Wicht

Nested Class Summary
 
Nested classes/interfaces inherited from class javax.swing.text.DocumentFilter
DocumentFilter.FilterBypass
 
Constructor Summary
DocumentLengthFilterAvert(int max, JTextField field)
          Construct a new DocumentLengthFilterAvert associated with a specific field and with a maximum number of characters.
 
Method Summary
 void remove(DocumentFilter.FilterBypass fb, int offset, int length)
           
 void replace(DocumentFilter.FilterBypass fb, int offset, int length, String str, AttributeSet attrs)
           
 
Methods inherited from class org.jtheque.utils.ui.DocumentLengthFilter
getMax, insertString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DocumentLengthFilterAvert

public DocumentLengthFilterAvert(int max,
                                 JTextField field)
Construct a new DocumentLengthFilterAvert associated with a specific field and with a maximum number of characters.

Parameters:
max - The maximum numbers of characters.
field - The field we want to associate to fhe filter.
Method Detail

remove

public void remove(DocumentFilter.FilterBypass fb,
                   int offset,
                   int length)
            throws BadLocationException
Overrides:
remove in class DocumentFilter
Throws:
BadLocationException

replace

public void replace(DocumentFilter.FilterBypass fb,
                    int offset,
                    int length,
                    String str,
                    AttributeSet attrs)
             throws BadLocationException
Overrides:
replace in class DocumentLengthFilter
Throws:
BadLocationException


Copyright © 2010 JTheque. All Rights Reserved.