This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Swing / AWT / SWT and the fly likes replacing characters in rtfeditorkit Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "replacing characters in rtfeditorkit" Watch "replacing characters in rtfeditorkit" New topic

replacing characters in rtfeditorkit

mark goking
Ranch Hand

Joined: Aug 18, 2009
Posts: 155
greetings. i have a little problem with my code. try to enter some few text in as many lines are you want. and press alt-p, some symbols will appear replacing newline and space characters.

my problem is when the caret cursor's position is beside the last line's text, that last line will disappear instead of being formatted. but if the caret position is in the last line, then everything will be formatted correctly and there are no missing text.


line 1: abcd1
line 2: abcd2
line 3: [caret cursor]
formats correctly

line 1: abcd1
line 2: abcd2 [caret cursor]

when i press alt-p only line 1 will be shown and formatted, line 2 is gone. i figure the problem may be somewhere in the scanmiddledotduplicate() method in the myrtfeditorkit class.

i have attached sample code ready to run and test

anyone got ideas? thanks

Website/Java Games:
Tech Blog:
I agree. Here's the link:
subject: replacing characters in rtfeditorkit
Similar Threads
font family of empty DefaultStyledDocument
Positioning slider relative to word in JtextPane.
While loop never stops
Automatically Scroll To a specific area in a JTextPane
regex utf-8 characters