Viewing nonprinting symbols in JTextPane

Hi!

Let me please, can I view nonprintig symbols in JTextPane (such as space, paragraph, tab) similar to MSWord
And how I can make this feature.
ybilevychAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

CEHJCommented:
getText() on the text control, do a find/replace on it and then setText()
0
wide_awakeCommented:
You could also create a subclass of JTextPane that would automatically swap the characters when text was added.

-mark.
0
OviCommented:
I believe the question is not how to get rid of special characters, but how to show them.
1. You should overwrite the default views for displaying the text (PlainView, LabelView, WrapedPlainView, etc) to allow this.
2. The other suggestion is to implement your own view to handle thevisual drawing of those chars, create special Elements to hold the characters and overwrite the default view factory implemented by the EditorKit, and serve your implementation when appropiate.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Cloud Class® Course: MCSA MCSE Windows Server 2012

This course teaches how to install and configure Windows Server 2012 R2.  It is the first step on your path to becoming a Microsoft Certified Solutions Expert (MCSE).

CEHJCommented:
ovi's way is better, although that should be 'override' not 'overwrite' ;-)
0
OviCommented:
:) excuse please a non english speacker&writer ...
0
CEHJCommented:
That's OK - English speakers do it too ;-)
0
CleanupPingCommented:
ybilevych:
This old question needs to be finalized -- accept an answer, split points, or get a refund.  For information on your options, please click here-> http:/help/closing.jsp#1 
EXPERTS:
Post your closing recommendations!  No comment means you don't care.
0
sciuriwareCommented:
Another suggestion: perform a getText() into a StringBuffer and consequently decide for yourself what and how you would like to display it (for instance <007> as \007 (4 characters) or as [BELL] ...)
use StringBuffer.replace()
Finally perform a setText() and it should show as you wanted it.
This way you don't have to write your own view processing: everything remains standard.
;JOOP!
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Java

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.