Constant size JTextArea and JTextField

Posted on 2009-04-08
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?
Question by:mdoland
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
LVL 86

Expert Comment

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

Expert Comment

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


Author Comment

ID: 24158355
I want this to work for 1.4.1 and this solution doesn't seem to work here. What would you do?
Creating Instructional Tutorials  

For Any Use & On Any Platform

Contextual Guidance at the moment of need helps your employees/users adopt software o& achieve even the most complex tasks instantly. Boost knowledge retention, software adoption & employee engagement with easy solution.

LVL 86

Accepted Solution

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

Author Closing Comment

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

Expert Comment

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

LVL 86

Expert Comment

ID: 24202194

Featured Post

MS Dynamics Made Instantly Simpler

Make Your Microsoft Dynamics Investment Count  & Drastically Decrease Training Time by Providing Intuitive Step-By-Step WalkThru Tutorials.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
eclipse apache tomcat admin console 52 156
JavaFX TableView not displaying correctly 3 109
hashmap order 17 42
program arguments vs VM arguments 4 31
Here is a helpful source code for C++ Builder programmers that allows you to manage and manipulate HTML content from C++ code, while also handling HTML events like onclick, onmouseover, ... Some objects defined and used in this source include: …
Introduction This article is the second of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers the basic installation and configuration of the test automation tools used by…
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:
This tutorial covers a practical example of lazy loading technique and early loading technique in a Singleton Design Pattern.

726 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