?
Solved

Constant size JTextArea and JTextField

Posted on 2009-04-08
7
Medium Priority
?
404 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 86

Accepted Solution

by:
CEHJ earned 1000 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

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

By the end of 1980s, object oriented programming using languages like C++, Simula69 and ObjectPascal gained momentum. It looked like programmers finally found the perfect language. C++ successfully combined the object oriented principles of Simula w…
In this post we will learn different types of Android Layout and some basics of an Android App.
Viewers will learn about arithmetic and Boolean expressions in Java and the logical operators used to create Boolean expressions. We will cover the symbols used for arithmetic expressions and define each logical operator and how to use them in Boole…
Viewers will learn one way to get user input in Java. Introduce the Scanner object: Declare the variable that stores the user input: An example prompting the user for input: Methods you need to invoke in order to properly get  user input:
Suggested Courses
Course of the Month13 days, 17 hours left to enroll

801 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