Limit the number of character entries in!_NEWLINE_!JTextPane
1 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Sunil_Dev
Posted On:   Tuesday, December 4, 2001 06:37 AM

I want to limit the number of characters to be input in a JTextPane to 200.Does anybody have a code for it

Re: Limit the number of character entries in!_NEWLINE_!JTextPane

Posted By:   Jon_Benton  
Posted On:   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.


Cheers,


Jon

About | Sitemap | Contact