Holger's Java API

## com.antelmann.util.gui
Class DocumentSizeFilter

    java.lang.Object
      javax.swing.text.DocumentFilter
          com.antelmann.util.gui.DocumentSizeFilter

    public class DocumentSizeFilter

extends DocumentFilter

limits documents to a given fixed size.

Since:
  29. Mai 2007, 13:24
Author:
  Holger Antelmann
See Also:
  `FormHelper.limitSize(javax.swing.text.JTextComponent, int)`, `JTextComponent.getDocument()`, `AbstractDocument`, `DocumentTextFilter`

Nested Class Summary

Nested classes/interfaces inherited from class javax.swing.text.DocumentFilter
`DocumentFilter.FilterBypass`

Constructor Summary
`DocumentSizeFilter(int maxChars)`

Method Summary
`static void` `applyLimit(JTextComponent c, int chars)`
`void` `insertString(DocumentFilter.FilterBypass fb, int offset, String string, AttributeSet attr)`
`void` `replace(DocumentFilter.FilterBypass fb, int offset, int length, String text, AttributeSet attrs)`

Methods inherited from class javax.swing.text.DocumentFilter
`remove`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### DocumentSizeFilter

    public DocumentSizeFilter(int maxChars)

Method Detail

### applyLimit

    public static void applyLimit(JTextComponent c,
                                  int chars)
                           throws ClassCastException

  Throws:
    `ClassCastException`

### replace

    public void replace(DocumentFilter.FilterBypass fb,
                        int offset,
                        int length,
                        String text,
                        AttributeSet attrs)
                 throws BadLocationException

  Overrides:
    `replace` in class `DocumentFilter`
  Throws:
    `BadLocationException`

### insertString

    public void insertString(DocumentFilter.FilterBypass fb,
                             int offset,
                             String string,
                             AttributeSet attr)
                      throws BadLocationException

  Overrides:
    `insertString` in class `DocumentFilter`
  Throws:
    `BadLocationException`

(c) Holger Antelmann since 2001- all rights reserved (contact: info@antelmann.com)
see www.antelmann.com/developer for further details and available downloads