I want something to work both as a user updating the contents of JTextArea, and manually by pressing the JButton button.
That doesn't make sense to me.
Why does clicking a button cause the same action as a user entering text into a text area?
I have not used Actions before, but I heard that they are useful for situations when you need something to be triggered by several controls
This operator is for controls that the user clicks, such as JMenuItems, JButtons, or by pressing Enter in the text box. In general, they can be used when you use an ActionListner.
The DocumentListener is not an ActionListener, as I previously stated that using an action does not seem appropriate.
I think you need to clarify your requirements.
Change based on explanation
if the user changes these other values, he may want to reanalyze the text
Why does the user have a choice? If you change the font, text, foreground, background of the text area, the component that it automatically repaints, you do not need to ask about it. If you look at the code for these methods, they always call the revalidate () and repaint () methods.
The parsing depends on other values ββset elsewhere in the GUI;
It looks like you need a custom class. Maybe ParsedTextArea or ParsedDocument. This class will contain "properties" that can be set elsewhere in the GUI. He will implement DocumentListener. It will also support your parseTheText method. Therefore, whenever a property is changed or a DocumentEvent document is created, you automatically call the parseTheText method. This way, you do not need a separate button, and the component will always be synchronized, because the parsing is automatic.