Any reason for bold and italic not nesting with StyleConstants?

I have this code:

privatevoid setBoldOn(){

StyleConstants.setBold(set,true);//this method, and the three following it, could well be lines of code instead of methods.

}

privatevoid setBoldOff(){

StyleConstants.setBold(set,false);

}

privatevoid setItalicsOn(){

StyleConstants.setItalic(set,true);

}

privatevoid setItalicsOff(){

StyleConstants.setItalic(set,false);

}

and:

currentDocument.insertString(currentDocument.getLength(), currentToken, set);

And for some reason, they don't seem to work together, any ideas why they refuse to nest?

Thank-you in advance.

Edit:

Where:private StyledDocument currentDocument;

private SimpleAttributeSet set =new SimpleAttributeSet();

Message was edited by:

abu5e

[1582 byte] By [abu5ea] at [2007-11-26 21:23:34]
# 1

Works fine for me.

If you need further help then you need to create a [url http://homepage1.nifty.com/algafield/sscce.html]Short, Self Contained, Compilable and Executable, Example Program[/url] (SSCCE) that demonstrates the incorrect behaviour, because I can't guess exactly what you are doing based on the information provided.

Don't forget to use the [url http://forum.java.sun.com/help.jspa?sec=formatting]Code Formatting Tags[/url] so the posted code retains its original formatting.

camickra at 2007-7-10 3:03:02 > top of Java-index,Desktop,Core GUI APIs...