• Post Reply Bookmark Topic Watch Topic
  • New Topic

my offsets are all wrong in my jtextpane got few questions.

 
steve labar
Ranch Hand
Posts: 55
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
So, i have an html page i run a regex on find a match then save the html page as string (already is one ) and get the offsets of the match.

Then i add the html text to the jtextpane with .settext() and get the highlighter and highlight with the offsets used from my regex from the raw string match.

I have done some testing and have found the length of the jtextpane.gettext() is larger then the string i set it with. This is my issue i can see that. I just cant seem to figure out what the extra stuff is and how to get these to to be same length so my offsets lineup.

I thought the jtextpane would be smaller because i thought it stripped \r. Very strange any ideas what extra stuff might be and how i can get the string i set it with and the gettext() to be same?
















 
Rob Camick
Ranch Hand
Posts: 2699
10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sounds like the Text and New Lines entry should give you a solution.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!