Re: an enclosing instance that contains javax.swing.text.StyleContext.NamedStyle is required



Christian wrote:
I got a bit further and found a posting
[http://groups.google.de/group/comp.lang.java.gui/browse_frm/thread/fc216d285c0b5a19/db7e77e2ade550ea?lnk=st&q=an+enclosing+instance+contains+is+required&rnum=8&hl=de#db7e77e2ade550ea]
that seems to adress my problem. But I still do not manage to adapt and
make the compiler (1.4.2_08) agree with this

StyleContext outer = new StyleContext();
// third point in the following line is rejected with ^ ( expected
StyleContext.NamedStyle inner = outer.new StyleContext.NamedStyle();

By now the problem seems to have turned into a syntax-error, the
compiler complains about the point seperating StyleContext.NamedStyle()
- but as I got it this points indicates: the inner class NamedStyle of
StyleContext is to be instantiated and so the point seems essential to
me. I tried quiet some possible combination of brackets - does anybody
see, what I still miss in this?

Christian


Try something like:

StyleContext.NamedStyle inner = outer.new NamedStyle();

You are already in the context of StyleContext because of outer.

Rogan
.