Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.java.programmer > #7354

How to repropagate resolved styles?

From Jan Burse <janburse@fastmail.fm>
Newsgroups comp.lang.java.programmer
Subject How to repropagate resolved styles?
Date 2011-08-25 00:50 +0200
Organization albasani.net
Message-ID <j33v81$ld8$1@news.albasani.net> (permalink)

Show all headers | View raw


Dear All

Maybe somebody could help me with the following. I am using
two styles as follows:

     private Style output;
     private Style input;

     SimpleAttributeSet aset = new SimpleAttributeSet();
     aset.setResolveParent(input);
     replaceRange("Hello", 0, 0, aset);

     SimpleAttributeSet aset = new SimpleAttributeSet();
     aset.setResolveParent(output);
     replaceRange(" World!", 5, 5, aset);

What get is a mixed attributed text, but the attribute was
provided via resolve parent. This works fine, the text comes
out as expected.

Now I am doing a side effect as follows:

      StyleConstants.setXXX(input, XXX).
      StyleConstants.setXXX(output, XXX).
      repaint();

The repaint has no effect. The text is shown the same as before.
But astonishingly when I do the following:

      setEditable(false);
      setEditable(true);

The resolve parent styles repropagate and the text changes as if
the resolve parents were logical styles on character level. Is
there another more proper way then calling setEditable twice, to
cause this update? Maybe something needs to be done earlier on, such
as registering the styles somewhere?

Any help appreciated.

Best Regards

Back to comp.lang.java.programmer | Previous | NextNext in thread | Find similar


Thread

How to repropagate resolved styles? Jan Burse <janburse@fastmail.fm> - 2011-08-25 00:50 +0200
  Re: How to repropagate resolved styles? Jan Burse <janburse@fastmail.fm> - 2011-08-25 22:58 +0200

csiph-web