• Post Reply Bookmark Topic Watch Topic
  • New Topic

jtextpane htmleditorkit convert space to  

 
mark goking
Ranch Hand
Posts: 155
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi. im actually asking for ideas which classes should be taken into account in order for this to happen.

i already have a working jtextpane component that uses an htmleditorkit

what i need to happen is when i do jtextpane.getText(), the space characters within the html tags would be replaced by  

haven't had luck with research. i tried to make use of HTMLDocument's getText() but there is no method to actually update it other than to insert it at some offset. then again, it could mess up the html formatting tags associated with it

anyone got ideas how to go about this? if all else fails i thought the only resolution would be to make a regex parser for this
 
Darryl Burke
Bartender
Posts: 5154
11
Java Netbeans IDE Opera
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Do you really want to replace all occurrences of a space with  ?

And a tip for you: to have   appear in your post, you need to type  
 
mark goking
Ranch Hand
Posts: 155
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
well .. yes. what im doing with the jtextpane is having an option where newlines, space characters and tabs will be replaced with symbols.

but i think parsing jtextpane.getText() is not a good idea since there would be html tags in it too
 
Darryl Burke
Bartender
Posts: 5154
11
Java Netbeans IDE Opera
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Use getDocument().getText(...)
 
mark goking
Ranch Hand
Posts: 155
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
im currently looking into the idea of maybe making a custom paragraph view

textpane.getText() would return the html content but id have to parse it.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!