Hello.
Use JTextArea on your GUI component. Whenever you open/work with a file load the file contents into this text area.
Add TextListener to the text area. Whenever the text changed event...