1 package tim.prune.load;
3 import javax.swing.text.AttributeSet;
4 import javax.swing.text.BadLocationException;
5 import javax.swing.text.PlainDocument;
8 * Document class to restrict text input to single character
9 * for selection of custom delimiter
11 public class OneCharDocument extends PlainDocument
13 public void insertString(int offs, String str, AttributeSet a)
14 throws BadLocationException
16 //This rejects the insertion if it would make
17 //the contents too long.
18 if ((getLength() + str.length()) <= 1)
19 super.insertString(offs, str, a);