File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Swing / AWT / SWT and the fly likes SWING: Limiting a JTextArea Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of REST with Spring (video course) this week in the Spring forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "SWING: Limiting a JTextArea" Watch "SWING: Limiting a JTextArea" New topic

SWING: Limiting a JTextArea

Chris Carney

Joined: Sep 28, 2004
Posts: 7
I am tiring to set up a JTextArea to be limited to 11 rows and 63 columns per row. I am having trouble doing so. Should I be using JTextArea? Any help is appreciated.

Nigel Browne
Ranch Hand

Joined: May 15, 2001
Posts: 673
Yes, you should be using JTextArea. It has a constructor that looks like this
so in your case construct the JTextArea as follows
Chris Carney

Joined: Sep 28, 2004
Posts: 7
I have tried that and it displays a Teaxt area large enougth to hold 63 chars and 11 rows. It does not stop the user from entering more rows or columns than 11 / 63.
Eddie Vanda
Ranch Hand

Joined: Mar 18, 2003
Posts: 281
This may give you some hints.

The nice thing about Standards is that there are so many to choose from!
I agree. Here's the link:
subject: SWING: Limiting a JTextArea
It's not a secret anymore!