wood burning stoves 2.0*
The moose likes Beginning Java and the fly likes line breaks in textfields? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "line breaks in textfields?" Watch "line breaks in textfields?" New topic
Author

line breaks in textfields?

steve tang
Greenhorn

Joined: Jun 12, 2005
Posts: 2
How can I make a line break in a textfield?
I want to make something like a list that requires line breaks and I want to add it to the end of a string

moveString += "(" + (k1 + 1) + "," + (k2 + 1) + ") " +\r\n; doesn't work

Thanks
Timmy Marks
Ranch Hand

Joined: Dec 01, 2003
Posts: 226
Don't know if this will solve your problem, but the \n should be in quotes as well:

moveString += "(" + (k1 + 1) + "," + (k2 + 1) + ")\n";

You probably don't need the \r.
Ilja Preuss
author
Sheriff

Joined: Jul 11, 2001
Posts: 14112
Are we talking about AWT, Swing, SWT, HTML or something different here?

Anyway, in most, if not all, of those, textfields can't show more than one line - you'll need a textarea for that.


The soul is dyed the color of its thoughts. Think only on those things that are in line with your principles and can bear the light of day. The content of your character is your choice. Day by day, what you do is who you become. Your integrity is your destiny - it is the light that guides your way. - Heraclitus
 
wood burning stoves
 
subject: line breaks in textfields?
 
Similar Threads
Searching for string usign JSTL
How do I pretty print xml?
switch question
labels, breaks, and continue questions
JTextArea and saving to a file