Brian Cole wrote:
Make a subclass of a Document type (probably PlainDocument) that rejects the chars you don't want. Set it into your text component either in the constructor or via the setDocument() method.
You showed up just in time for the waffles! And this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koophttps://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton