Created
October 4, 2013 21:13
-
-
Save leapingbytes/6832881 to your computer and use it in GitHub Desktop.
this seems to work. it reports reasonable attributes. for example for bold + italic: attributes : name : content
attributes : font-style : italic
attributes : color : #ffffff
attributes : b : attributes : i : attributes : font-weight : bold
attributes : font-family : Arial
attributes : font : size=3 color=#ffffff face=Arial attributes : font-siz…
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Caret cr = me.reachTextField.getCaret(); | |
int position = cr.getDot() | |
Element e = me.reachTextField.getStyledDocument().getCharacterElement(position); | |
AttributeSet attributes = e.getAttributes(); | |
Enumeration attributeNames = attributes.getAttributeNames(); | |
while(attributeNames.hasMoreElements()) { | |
Object name = attributeNames.nextElement(); | |
System.out.println("attributes : " + name + " : " + attributes.getAttribute(name)); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment