1

I am doing on WYSIWYG Html Editor using Java Program. I need When I click mouse on Paragraph element, It should be displays

tag in JOption dialog. Please advice me How can i do this?

Rishi
  • 95
  • 2
  • 9

1 Answers1

5

See for example this one http://java-sl.com/JEditorPaneStructureTool.html

In simple words you can get your HTMLDocument and get paragraph using getParagraphElement() method. Use viewToModel() method of JEditorPane to get caret offet for the clicked point.

StanislavL
  • 56,971
  • 9
  • 68
  • 98
  • I am a big fan of `viewToModel(...)` and `modelToView(...)` ever since I had heard of them, +1 for the answer :-) – nIcE cOw May 10 '12 at 12:52