Path: csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!news.albasani.net!.POSTED!not-for-mail From: Jan Burse Newsgroups: comp.lang.java.programmer Subject: How to repropagate resolved styles? Date: Thu, 25 Aug 2011 00:50:32 +0200 Organization: albasani.net Lines: 41 Message-ID: Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-15; format=flowed Content-Transfer-Encoding: 7bit X-Trace: news.albasani.net PwhusE/JfcjWPzf5Bucv3HqxNMvSmhpYckRbyHEum0YQRM/5Ejn3/gqUN339PdILt8fA5Zs76aUTip/LXUmMhVNu5luay+6AxyUYYTPGH89MNmZC3VUOW9+9A4GksZ1Y NNTP-Posting-Date: Wed, 24 Aug 2011 22:50:41 +0000 (UTC) Injection-Info: news.albasani.net; logging-data="CcO7/a7gT+0+vncpywDpb/8lUsFm6MQSEu/Vueovyk1QDtA4sCSxeFMVMaeJ2CRrivUHTyooZH3I0ro8MOvqOeLfjYMlVaD9Qyfb+j9inmZRGYGDrGIgOxukOQ2Y+v5V"; mail-complaints-to="abuse@albasani.net" User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:6.0) Gecko/20110813 Firefox/6.0 SeaMonkey/2.3 Cancel-Lock: sha1:x3jeloM9X4dO+HW/q2BALwfLTR8= Xref: x330-a1.tempe.blueboxinc.net comp.lang.java.programmer:7354 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