I want to know whether we can find a tag in JEditorPane in java swing where my cursor is pointing..
For ex.
following is the text content in my editor pane..
<html>
<head>
<body>
<div><!--Cursor inside the div tag--></div>
</body>
</html>
for instance suppose this is the text inside my editor pane. and my cursor is inside the tag. now what i want is a function that returns me the tag in which the cursor is. Is it possible?
Here cursor is in <div> tag so function should return "div" or "<div>".
Yes.
DIVis defined inHTML.Tag, so you can iterate though the elements of yourHTMLDocumentin aCaretListener. You can get the offsets from the attribute’s child element.