protected Document createDefaultModel() {

		return new PlainDocument() {

			public void insertString(int offs, String str, AttributeSet a) throws BadLocationException {

				if (permit != null) {

					char[] source = str.toCharArray();
					char[] result = new char[source.length];
					int j = 0;

					for (int i = 0; i < result.length; i++) {
						for (int k = 0; k < permit.length; k++) {
							if (caseSensitive) {
								if (source[i] == permit[k]) {
									result[j++] = source[i];
								}
							}
							else {
								if (source[i] == permit[k] || source[i] == permit[k] - 32
										|| source[i] == permit[k] + 32) {
									result[j++] = source[i];
								}
							}
						}
					}

					// if(old==null || (old!=null && length>0 && old.length<length)){
					super.insertString(offs, new String(result, 0, j), a);
					// }

				}

				else {

					super.insertString(offs, str, a);

				}

			}

		};

	}