Solved

Constant size JTextArea and JTextField

Posted on 2009-04-08
7
394 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
Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

 
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

Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

Question has a verified solution.

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

Suggested Solutions

For beginner Java programmers or at least those new to the Eclipse IDE, the following tutorial will show some (four) ways in which you can import your Java projects to your Eclipse workbench. Introduction While learning Java can be done with…
Programmer's Notepad is, one of the best free text editing tools available, simply because the developers appear to have second-guessed every weird problem or issue a programmer is likely to run into. One of these problems is selecting and deleti…
Viewers will learn about basic arrays, how to declare them, and how to use them. Introduction and definition: Declare an array and cover the syntax of declaring them: Initialize every index in the created array: Example/Features of a basic arr…
Viewers will learn about the regular for loop in Java and how to use it. Definition: Break the for loop down into 3 parts: Syntax when using for loops: Example using a for loop:

813 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

10 Experts available now in Live!

Get 1:1 Help Now