Ola!

This is my first post so i hope its not a stupid one ^_^

ok, I have large quantities text i want to read into my jTextArea, to keep it all nice and clean i use tabs(6 chars long), the problem is that sometimes the words or strings get a bit long and it words and line wraps, as i Set the jTextArea to do, now if it does this it kinda screws up my tabs

i.e the text in jtextarea looks like this:

Action:	        1) Obtain Cancellation Letter from the Dealership or Client Clearly stating that the client does not have the vehicle and reason for Cancellation
	        2) Make Note in Reward regarding the reason for Cancellation

and it should look like this:

Action:	        1) Obtain Cancellation Letter from the Dealership or Client 
                Clearly stating that the client does not have the vehicle and reason for 
                Cancellation
	        2) Make Note in Reward regarding the reason for Cancellation

how do I add a "\t" or Tab just after it word wraps? do i implement a listener and how would I go about that?

Thanks Krefie

Recommended Answers

All 7 Replies

Soz using code brackets was the only way i could get my example across ^_^

Can you show your code?

what code? its a simple question really, after the jtextarea word wraps i want to insert a tab or \t before it inserts the wrapped words..

what code?

Just about everything you do in a program is code.

haha ^_^ i know but its a simple

txtafvoer.append("Action:\t lalalalalalalalalalalalalalaAAAAAAAAAAAA");

now, the "action" & "lalala" is seperated by a tab, and the "AAAAA" line wraps(because the string is to long), so i want the "AAAAAAAA" that was line wrapped to be at the same tabbed position as "lalalalala"

krefie

There are document listeners that might have a place for you to put the code to detect when a string is too long and to split it into parts and insert the tab character where needed.
Or simpler, before you do the append() can your code detect if the string will wrap, then split the string and insert the newline and tabs as needed?

didnt think of that ^_^ fanx

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.