Skip to main content
GameDev.net gamedev.net
🔒 Locked

[java] Swing's JTextArea question

Started by Malderi Sep 20, 2006 at 9:15 PM 0 replies 1k views
Original Post
Malderi
Malderi
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.
Shabadoo
Shabadoo
You might be able to get some ideas from here:

click

Cheers,
Brett

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.