• Advertisement
Sign in to follow this  

[java] Swing's JTextArea question

This topic is 4169 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