Skynes Member Posts: 202 From: Belfast, N Ireland Registered: 01-18-2004 |
I need a hand with getting a bit of Java right. I'm using a method called displayAll() which returns all objects(containing 2 strings and an integer) in my dynamic array as a string. Within the string I'm using /n and /t to space out the values and take new lines where appropriate. In a text based program it works perfectly, takes lines when it needs to and lines up perfectly. However when I use this same method with my Applet GUI in a list box or even just a label It doesn't space out, instead it gives a Box symbol. Does anyone know a way I can get my listbox to display this string like text based does, taking new lines everytime it hits a /n ? |
GUMP Member Posts: 1335 From: Melbourne, FL USA Registered: 11-09-2002 |
Oh, I remember doing this two years ago. If I look at some of my old code I may find how I did it. |
Danno Member Posts: 15 From: Seattle, WA Registered: 01-20-2001 |
You might want to try using the backslash "\" instead of the forward slash. In other words, use \n instead of /n. Thanks, Dan |
Skynes Member Posts: 202 From: Belfast, N Ireland Registered: 01-18-2004 |
My code was \n not /n. I mixed em up on here but my code definitely has \n [This message has been edited by skynes (edited January 30, 2004).] |
GUMP Member Posts: 1335 From: Melbourne, FL USA Registered: 11-09-2002 |
System.getProperty("line.separator") An example of it being used: term.append(System.getProperty("line.separator") + "[" + new Date() + "] " + data); This was used in the terminal window that was part of my program. [This message has been edited by Gump (edited January 30, 2004).] |
Skynes Member Posts: 202 From: Belfast, N Ireland Registered: 01-18-2004 |
And how do I use that? Never seen anything like it before. |
GUMP Member Posts: 1335 From: Melbourne, FL USA Registered: 11-09-2002 |
The System.getProperty function just returns whatever information you ask for it. In this case you're asking for the symbol being used by the system for the "line separator" or "next line" or whatever you call it. [This message has been edited by Gump (edited February 03, 2004).] |
Skynes Member Posts: 202 From: Belfast, N Ireland Registered: 01-18-2004 |
too late now tho :P Handed in the Cw on Mon. Will remember that next time I do list boxes tho thanx. |