Holger's Java API

## com.antelmann.util.gui
Class DocumentTextFilter

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

    public class DocumentTextFilter

extends DocumentFilter

allows to use a common `Filter` to be used as a DocumentFilter. Note that the filter is applied on each individual update.

Since:
  19.02.2014, 00:56:36
Author:
  holger
See Also:
  `DocumentSizeFilter`

Nested Class Summary

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

Constructor Summary
`DocumentTextFilter(Filter<String> filter)`
`DocumentTextFilter(Filter<String> filter, boolean beepOnError)`

Method Summary
`static void` `applyFilter(JTextComponent c, Filter<String> filter)`
`protected void` `badInputReaction(DocumentFilter.FilterBypass fb, String rejectedString)`
`Runnable` `getBadInputAction()`
`void` `insertString(DocumentFilter.FilterBypass fb, int offset, String string, AttributeSet attr)`
`boolean` `isShowDialogOnError()`
`void` `remove(DocumentFilter.FilterBypass fb, int offset, int length)`
`void` `replace(DocumentFilter.FilterBypass fb, int offset, int length, String text, AttributeSet attrs)`
`void` `setBadInputAction(Runnable badInputAction)`
`DocumentTextFilter` `setShowDialogOnError(boolean flag)`

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

Constructor Detail

### DocumentTextFilter

    public DocumentTextFilter(Filter<String> filter)

### DocumentTextFilter

    public DocumentTextFilter(Filter<String> filter,
                              boolean beepOnError)

Method Detail

### applyFilter

    public static void applyFilter(JTextComponent c,
                                   Filter<String> filter)
                            throws ClassCastException

  Throws:
    `ClassCastException`

### isShowDialogOnError

    public boolean isShowDialogOnError()

### setShowDialogOnError

    public DocumentTextFilter setShowDialogOnError(boolean flag)

### getBadInputAction

    public Runnable getBadInputAction()

### setBadInputAction

    public void setBadInputAction(Runnable badInputAction)

### badInputReaction

    protected void badInputReaction(DocumentFilter.FilterBypass fb,
                                    String rejectedString)

### remove

    public void remove(DocumentFilter.FilterBypass fb,
                       int offset,
                       int length)
                throws BadLocationException

  Overrides:
    `remove` 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`

### replace

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

  Overrides:
    `replace` 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