SSISO Community

시소당

JEditorPane 문서상에서 마우스 클릭한 부분의 태그 보여주기

MouseEvent  me  =  //  mousePressEvent  ;
HTMLDocument  doc  =  (HTMLDocument)  editorPane.getDocument();
Element  elem  =  doc.getCharacterElement(
        editorPane.viewToModel(me.getPoint())
    );

/*  You  may  have  to  do  -
Element  elem  =  doc.getParagraphElement(
        editorPane.viewToModel(me.getPoint())
    );
*/

AttributeSet  attr  =  elem.getAttributes();

//  Alternative  approach  could  be  
/*
AttributeSet  attr  =  doc.getLogicalStyle(
        editorPane.viewToModel(me.getPoint())
    );
*/

[출처]  JEditorPane  문서상에서  마우스  클릭한  부분의  태그  보여주기  |작성자  처리
http://blog.naver.com/ace772?Redirect=Log&logNo=120005152613

543 view

4.0 stars