Meaningless Drivel is fun!*
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 Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "replacing characters in rtfeditorkit" Watch "replacing characters in rtfeditorkit" New topic
Author

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.

e.g.

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: http://www.chitgoks.com
Tech Blog: http://tech.chitgoks.com
 
 
subject: replacing characters in rtfeditorkit
 
Similar Threads
Positioning slider relative to word in JtextPane.
While loop never stops
Automatically Scroll To a specific area in a JTextPane
regex utf-8 characters
font family of empty DefaultStyledDocument