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("");
c5.gridx = 1; c5.gridy = (i*3+0); p.add(bob, c5);
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.