Hello,

i'm trying to make a a list of items in a Text Area, something like this:

apple 2 22
banana 31 1
orange 1 3


i want to it o be organized such that the numbers are in one column, and thats not working with me since the names of fruit have different lengths.
i tried to use insert ( str , pos ); method, but it didnt work well for me.
is there a method that might help?

Recommended Answers

All 3 Replies

and i cant even post them under each other in my my post here as well.
i hope u got what i'm asking for?

and i cant even post them under each other in my my post here as well.
i hope u got what i'm asking for?

Hello,

try it like this :

"apple\t2\t22"
"banana\t31\t1"
"orange\t1\t3"

escape sequence (valid ones are \b \t \n \f \r \" \' \\ )

Edited :

textAreaObj.setText("apple\t2\t22\nbanana\t31\t1\norange\t1\t3");

Output:

apple	2	22
banana	31	1
orange	1	3

Regards,

oh yeah it worked. many thanks to you ;)
everything is in order now. thanks again

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.