Jump to content
  • Advertisement
Sign in to follow this  
Malderi

[java] Swing's JTextArea question

This topic is 4445 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I'm having something of a problem with a bit of Java interface code. Here's the situation: I have a JTextArea on a frame. I want the user to input some text of variable length into the JTextArea for later retrieval by my application. HOWEVER, I want there to be a maximum number of rows of data (and, a maximum column count too, but that's handled by the word wrap.) Here's the problem: I can't set the maximum number of rows. setRows(int) does not work. Whenever I type past the end of the JTextArea, the text cursor just goes off the component and into never-never land. I'm still typing - I can do things like shift-home ctrl-c and copy the text I wrote, even if I can't see it. I just want it to not allow any further input after a specified number of rows. I can't get it to do that. Any help would be much appreciated, thanks all.

Share this post


Link to post
Share on other sites
Advertisement
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!