Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
Thread: Formating a JTextField
01-21-2013, 01:32 AM #1
- Join Date
- Jul 2012
- Thanked 0 Times in 0 Posts
Formating a JTextField
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?
JTextField bob = new JTextField(""); bob.setPreferredSize(new Dimension(300,20)); c5.gridx = 1; c5.gridy = (i*3+0); p.add(bob, c5);
01-21-2013, 04:30 AM #2
- Join Date
- Sep 2002
- Saskatoon, Saskatchewan
- Thanked 2,662 Times in 2,631 Posts
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.
Been gone for a few months, and haven't programmed in that long of a time. Meh, I'll wing it ;)PHP Code:
header('HTTP/1.1 420 Enhance Your Calm');