How can I get a bigger textfield?

What I mean is:

Let's say that I'm going to register a bunch of cars in a program I made. I want to register things like name, model, when it's made etc + description.
I can make simple JTextFields for most of them, but JTextField is too small for the description. I want to write at least 3-4 lines about the car. What do I have to create to make a field big enough for description?

I tried something called:

textFieldName.setPreferredSize(new Dimension(integer, integer));

But it's not what I want. It gives me the right size with the right values, but I'd like it to possible to press enter for a new line. How should I do this?

I hope I explained it well, english isn't my native language. If you don't understand, I'll explain it better.

Thanks in advance.

6 Years
Discussion Span
Last Post by JamesCherrill

If you want multiple lines, look at using a text area instead of a text field.


Thanks man.

Also, I've got one more question. It's kind of offtopic.

Right now my layout is like:

Label, textfield, label, textfield, label
textfield, label, textfield, 
label, textfield, label
textfield, button

What I want is it to be like:

Label textfield
Label Textfield
Label Textfield
Button1, Button 2

How should I do this? I've no experience about layouts, I've just used FlowLayout, very simple one, and my program was always unstructured. Now I need more structur D:

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.