Tuesday, December 4, 2001 06:47 PM
I had to do something much like this recently.
If you look in the Javadoc info for JTextField, you'll see some example code for creating your own text component with its own Document where, you guessed it, you get to control what and how much goes into the document.
What I did was create a LimitedLengthDocument class, and pass an instance into the constructor for a text object. Works like a charm.