How to limit JTextArea to a valid character set?

Does anyone know if there is an easy way to limit valid characters to JTextArea. That is similar to JTextField, using MaskFormatter.

In particular, I want to restrict valid characters for JTextArea to only uppercase letters and only very limited character sets, for example! "# ยค% & / () =

+3
source share
4 answers

Enter a javax.swing.text.DocumentFilterto remove inappropriate characters. Install it on your favorite AbstractDocumentand create with it JTextArea.

+2
source
+2

PlainDocument insertString(), . JTextArea.

0

JTextArea. insertString DocumentFilter,

0

Source: https://habr.com/ru/post/1721172/


All Articles