Using DocumentFilter.FilterBypass
For instance, here’s an SSCCE with a DocumentFilter which prevents the user from typing numbers into the document but allows the Swing Timer to do so. import java.awt.event.*; import java.awt.event.ActionListener; import javax.swing.*; import javax.swing.text.*; public class DocFilterPanel extends JPanel { private JTextArea textArea = new JTextArea(12, 50); private MyDocFilter myDocFilter = new MyDocFilter(); public DocFilterPanel() … Read more