Getting style from any offset in JTextPane

后端 未结 1 358
不思量自难忘°
不思量自难忘° 2021-01-15 00:11

Is there a way to get Style, a style name or just even compare whether Style at a certain position of JTextPane with the style I gave

相关标签:
1条回答
  • 2021-01-15 00:40

    Try calling StyledDocument.getCharacterElement(pos) to get the character element at that position and then call Element.getAttributes() to get its attribute set.

    The AttributeSet contains styles which you can retrieve using methods provided by StyleConstants.

    0 讨论(0)
提交回复
热议问题