First of all,
you should rarely need to implement Action. Extending AbstractAction is a much more common approach.
For the text component, there are two ways I can think of:
- use a KeyListener or key binding (using InputMap and ActionMap) if the contents are only entered from the user interface.
- use a DocumentListener if the contents can come from code as well.