Results 1 to 4 of 4
Thread: New line in Strings
- 09-07-2011, 10:09 AM #1
New line in Strings
Hi there. I was trying to add line separators to a String in my JApplet, but it seems to not work.
Just after defining the class, I define the "newline" variable:
Java Code:static final String newline = System.getProperty("line.separator");
Java Code:String strNegativeRectangle = ( "Fr = " +strFr +newline +"Em = " +strEm); g2.drawString(strNegativeRectangle,10,10);
So, it should look like:
Fr = strFr
Em = strEm
But it looks like:
Fr = strFrEm = strEm
Well, where's the error ? :S
Thanks and regards.Last edited by Josep_16; 09-07-2011 at 10:15 AM.
- 09-07-2011, 01:01 PM #2
Re: New line in Strings
use the "\\n" for line separator in string
sanjeev,संजीव
- 09-07-2011, 01:12 PM #3
- Join Date
- Sep 2008
- Location
- Voorschoten, the Netherlands
- Posts
- 14,422
- Blog Entries
- 7
- Rep Power
- 29
- 09-07-2011, 01:33 PM #4
Similar Threads
-
How to make new-line when p rinting strings?
By ozzyman in forum Java 2DReplies: 2Last Post: 05-04-2011, 09:24 AM -
How to read file line by line with fixed number of characters
By trkece in forum New To JavaReplies: 1Last Post: 02-13-2011, 03:09 PM -
tracing java application line by line using netbeans
By chandrasekhar123 in forum NetBeansReplies: 1Last Post: 08-03-2010, 02:46 PM -
Formatting java command line output - Multi line string
By dricco in forum New To JavaReplies: 2Last Post: 07-02-2010, 02:20 PM -
Need to read an .ini and .abook file line by line (both files contain texts)
By ollyworks in forum Java AppletsReplies: 4Last Post: 09-10-2009, 10:18 AM
Bookmarks