Solved

Constant size JTextArea and JTextField

Posted on 2009-04-08
7
391 Views
Last Modified: 2013-11-23
How do I make the JTextArea and JTextField to be of a certain size no matter to what I set i t to contain?
0
Comment
Question by:mdoland
  • 3
  • 2
  • 2
7 Comments
 
LVL 86

Expert Comment

by:CEHJ
ID: 24095036
Provide a custom Document for the components. Override PlainDocument,insertString to allow only a certain length of String
0
 
LVL 92

Expert Comment

by:objects
ID: 24102993
depends on the layout manager being used, but setting the preferred size on most will achieve that

0
 

Author Comment

by:mdoland
ID: 24158355
I want this to work for 1.4.1 and this solution doesn't seem to work here. What would you do?
0
6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

 
LVL 86

Accepted Solution

by:
CEHJ earned 250 total points
ID: 24158617
>>I want this to work for 1.4.1

It will work afaik for an version >= 1.2
0
 

Author Closing Comment

by:mdoland
ID: 31567909
Great, finally got it working. Love it!!
0
 
LVL 92

Expert Comment

by:objects
ID: 24202159
sorry misunderstood what you need.
the folowojgn shows what you need

http://helpdesk.objects.com.au/java/how-to-limit-number-of-characters-in-jtextfield

0
 
LVL 86

Expert Comment

by:CEHJ
ID: 24202194
:-)
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Jaspersoft Studio is a plugin for Eclipse that lets you create reports from a datasource.  In this article, we'll go over creating a report from a default template and setting up a datasource that connects to your database.
Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
This video teaches viewers about errors in exception handling.
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …

705 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now