The easiest way to do this is to add a javax.swing.event.DocumentListener to the editor's Document, and add the "*" to the displayed file name when the document is modified. Remove it whenever it is saved.
You can also use the org.fife.ui.rsyntaxtextarea.TextEditorPane
class, that comes standard in the library. It has a "dirty" flag that is set/cleared properly when you edit/save/reload the file. You can also query it directly via the isDirty() method. Note that you'll still have to add the DocumentListener though to know when it's first made dirty.
From its documentation:
An extension of RSyntaxTextArea that adds information about the file being edited, such as:
Its name and location.
Is it dirty?
Is it read-only?
The last time it was loaded or saved to disk (local files only).
The file's encoding on disk.
Easy access to the line separator.
Loading and saving is also built into the editor.
Both local and remote files (e.g. ftp) are supported. See the FileLocation class for more information.