File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
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
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
It's not a secret anymore!