The suggestion you received on dreamincode.net is certainly doable. But it is, in my humble opinion, a less elegant solution than the
DocumentFilter solution and can be more problematic. I've seen solutions like that break under extreme circumstances (think a 5-year old banging on a keyboard.)
The
DocumentFilter exists to solve the very problem you want to solve. As such, it is probably the solution
you should use.
You can see an example of a
DocumentFilter being used to solve the very problem you are trying to solve at exampledepot.com:
Limiting the Capacity of a JTextComponent
When trying to solve problems like this, my recommendation and advice is not to shy away from solutions that use something "that [you] don't know much about". You will have to work with things you do not know much about all the time in programming. It is the nature of the beast. Learning how to assimilate to something new is a valuable skill. And the more you do it, the better you become at it. Just some advice that I think will help you become a better programmer.