Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

Viewing nonprinting symbols in JTextPane

Posted on 2003-03-24
8
Medium Priority
?
259 Views
Last Modified: 2010-03-31
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.
0
Comment
Question by:ybilevych
8 Comments
 
LVL 86

Expert Comment

by:CEHJ
ID: 8196729
getText() on the text control, do a find/replace on it and then setText()
0
 
LVL 3

Expert Comment

by:wide_awake
ID: 8197770
You could also create a subclass of JTextPane that would automatically swap the characters when text was added.

-mark.
0
 
LVL 9

Accepted Solution

by:
Ovi earned 150 total points
ID: 8200567
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
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 86

Expert Comment

by:CEHJ
ID: 8201561
ovi's way is better, although that should be 'override' not 'overwrite' ;-)
0
 
LVL 9

Expert Comment

by:Ovi
ID: 8201871
:) excuse please a non english speacker&writer ...
0
 
LVL 86

Expert Comment

by:CEHJ
ID: 8201886
That's OK - English speakers do it too ;-)
0
 

Expert Comment

by:CleanupPing
ID: 9058514
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
 
LVL 24

Expert Comment

by:sciuriware
ID: 9519271
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

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
In this post we will learn different types of Android Layout and some basics of an Android App.
Video by: Michael
Viewers learn about how to reduce the potential repetitiveness of coding in main by developing methods to perform specific tasks for their program. Additionally, objects are introduced for the purpose of learning how to call methods in Java. Define …
Viewers will learn about the different types of variables in Java and how to declare them. Decide the type of variable desired: Put the keyword corresponding to the type of variable in front of the variable name: Use the equal sign to assign a v…
Suggested Courses
Course of the Month15 days, 21 hours left to enroll

580 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question