Sorry, I should have been more clear. If you use one of TextEditorPane's load(), save(), or saveAs() methods, it should automatically clear the undo stack. If it doesn't then it's a bug. Calling setText() will always be an undoable edit, as you've noticed.
You might need the latest from SVN for this though, as I noticed at least one instance recently where this wasn't happening.