?
Solved

Viewing nonprinting symbols in JTextPane

Posted on 2003-03-24
8
Medium Priority
?
255 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
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

Independent Software Vendors: 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

Java Flight Recorder and Java Mission Control together create a complete tool chain to continuously collect low level and detailed runtime information enabling after-the-fact incident analysis. Java Flight Recorder is a profiling and event collectio…
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…
Viewers learn about the “for” loop and how it works in Java. By comparing it to the while loop learned before, viewers can make the transition easily. You will learn about the formatting of the for loop as we write a program that prints even numbers…
Viewers learn about the scanner class in this video and are introduced to receiving user input for their programs. Additionally, objects, conditional statements, and loops are used to help reinforce the concepts. Introduce Scanner class: Importing…
Suggested Courses
Course of the Month8 days, 2 hours left to enroll

765 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