Win a copy of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js this week in the JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Get LeafElement from DefaultStyledDocument by Point(x,y) ??  RSS feed

 
Janus Engstrøm
Ranch Hand
Posts: 44
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi ranchers,

Here's a tough one (I think):

I have a StyledDocument with a default StyleContext.
That StyledDocument is the document of a JEditorPane, which renders the document through a RTFEditorKit.

I can fetch the LeafElement at a specific index from the DefaultStyledDocument (AbstractDocument) by calling



-but I need to fetch that LeafElement through a Point(x, y) instead (actually all LeafElements within a y-coordinate space range).

How can I do this?


With kind regards,
Janus

 
Craig Wood
Ranch Hand
Posts: 1535
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can use the JTextComponent method viewToModel.
 
Janus Engstrøm
Ranch Hand
Posts: 44
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Dude, you rock!

Regards,
Janus
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!