Go Back   CodingForums.com > :: Server side development > Java and JSP

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 01-21-2013, 01:32 AM   PM User | #1
Atlan
New Coder

 
Join Date: Jul 2012
Posts: 14
Thanks: 2
Thanked 0 Times in 0 Posts
Atlan is an unknown quantity at this point
Formating a JTextField

Hi again.

I'm creating a form, which uses JTextFields to enter and store text.

The problem is, I create a large JTextField, which has room to store about 4 lines of text. But the text doesn't take advantage of the room. The text is created in the center-left of the text box, and fills along horizantally. When it reaches the end, it keeps going off the side of the JTextField.

What I WANT it do to is behave like any text-entry box on the internet- like the ones on this forum, where it starts in the top-left, and when it reaches the other side, it drops down a line.

Any idea how to do this?

Code:
 JTextField bob = new JTextField("");  
 bob.setPreferredSize(new Dimension(300,20));
c5.gridx = 1; c5.gridy = (i*3+0); p.add(bob, c5);
Atlan is offline   Reply With Quote
Old 01-21-2013, 04:30 AM   PM User | #2
Fou-Lu
God Emperor


 
Fou-Lu's Avatar
 
Join Date: Sep 2002
Location: Saskatoon, Saskatchewan
Posts: 15,662
Thanks: 4
Thanked 2,452 Times in 2,421 Posts
Fou-Lu is a name known to allFou-Lu is a name known to allFou-Lu is a name known to allFou-Lu is a name known to allFou-Lu is a name known to allFou-Lu is a name known to all
I guess this depends on what you are comparing to. There are two major text input components in HTML, one is the text input type which is similar to the JTextField, and the other is the textarea which is similar to the JTextArea/JEditorPane/JTextPane.
Methinks you are intending to make use of a multiline input such as the JTextArea. If you want it to be styleable, its easiest to use the JEditorPane.
__________________
As of PHP 5.5, the MySQL library has been officially deprecated. It is recommended to move to either MySQLi or PDO libraries for your mysql connectivity. See here for help choosing which interface you prefer: http://php.net/manual/en/mysqlinfo.api.choosing.php
Fou-Lu is offline   Reply With Quote
Reply

Bookmarks

Tags
formating, java, jtextfield, text

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 07:54 AM.


Advertisement
Log in to turn off these ads.