posted 22 years ago
Hi,
I want to add new actions to my JTextPane using HTMLEditorKit, for example i want to have actions to add headers (H1 etc). I want these actions to function as the already existing BoldAction, ItalicAction etc. I have no problem in inserting the HTML, but i also want to be able to toggle it off and on (like BoldAction), ie if I select text within <H1> tags and once again press my H1 button i want the H1 tags to disappear. So far I havent had any luck with this.
Also when I get the attributes at a given caret position using doc.getCharacterElement(pos).getAttributes() i can only retreive the attributes that there are already actions for (bold, italic, underlined) and not my newly added headers. Annoying.
Does anyone have any ideas?
Thank you
/Andreas