Results 1 to 1 of 1
- 07-19-2008, 08:09 PM #1Member
- Join Date
- Jul 2008
- Rep Power
JTextPane (reading char and its attributes)
I am trying to write a simple editor, where a person could write his text (in different size and color etc.) and than i need to turn this text to html code.
So the way that i determen the shape of the text in JTextPane is:
And now, when the text is done, i have to convert this to a simple html code. My idea of doing that is, to go trough the text (TextPane.setCaretPosition(x); TextPane.moveCaretPosition(x+1);).
So so far so good...but now i have to get the attributes of this character (and only of this character)!
pane.getCharacterAttributes().getAttributeCount()...this does this:
0001111 (number of attributes)
so on the text later, the previus attibute of the letter is still being counted in, but it should not be so (as the getCharacterAttributes() uses the caret to find that out).
Is the whole approach wrong? Or how to fix this?
- By kinabaloo in forum Advanced JavaReplies: 2Last Post: 07-11-2008, 06:32 AM
- By Java Tip in forum javax.swingReplies: 0Last Post: 06-27-2008, 07:48 PM
- By x0psci in forum New To JavaReplies: 0Last Post: 11-23-2007, 05:28 PM
- By osval in forum AWT / SwingReplies: 1Last Post: 07-29-2007, 09:11 AM
- By Ada in forum AWT / SwingReplies: 1Last Post: 05-31-2007, 09:50 PM