@@ -0,0 +1,2290 @@
+/**%0A * The MIT License (MIT)%0A * Copyright (c) 2016 Mark Bernard%0A * %0A * Permission is hereby granted, free of charge, to any person obtaining a copy of %0A * this software and associated documentation files (the %22Software%22), to deal in the %0A * Software without restriction, including without limitation the rights to use, copy, %0A * modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, %0A * and to permit persons to whom the Software is furnished to do so, subject to the following conditions:%0A * %0A * The above copyright notice and this permission notice shall be included in all copies or %0A * substantial portions of the Software.%0A * %0A * THE SOFTWARE IS PROVIDED %22AS IS%22, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, %0A * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR %0A * PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE %0A * FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR %0A * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.%0A */%0Apackage io.github.markbernard.jnotepad;%0A%0Aimport java.util.regex.Pattern;%0A%0Aimport javax.swing.text.AttributeSet;%0Aimport javax.swing.text.BadLocationException;%0Aimport javax.swing.text.DocumentFilter;%0A%0A/**%0A * @author Mark Bernard%0A */%0Apublic class NumberDocumentFilter extends DocumentFilter %7B%0A    private static final Pattern NUMBER_PATTERN = Pattern.compile(%22%5E%5C%5Cd+$%22);%0A    %0A    @Override%0A    public void remove(FilterBypass fb, int offset, int length) throws BadLocationException %7B%0A        super.remove(fb, offset, length);%0A    %7D%0A%0A    @Override%0A    public void insertString(FilterBypass fb, int offset, String string, AttributeSet attr) throws BadLocationException %7B%0A        if (containsOnlyNumeric(string)) %7B%0A            fb.insertString(offset, string, attr);%0A        %7D%0A    %7D%0A%0A    @Override%0A    public void replace(FilterBypass fb, int offset, int length, String text, AttributeSet attrs) throws BadLocationException %7B%0A        if (containsOnlyNumeric(text)) %7B%0A            fb.replace(offset, length, text, attrs);%0A        %7D%0A    %7D%0A%0A    private boolean containsOnlyNumeric(String text) %7B%0A        return NUMBER_PATTERN.matcher(text).find();%0A    %7D%0A%7D%0A

Create NumberDocumentFilter.java