 |
AppletTalk.com Java discussions newsgroups
|
| View previous topic :: View next topic |
| Author |
Message |
Krzysztof Bink Guest
|
Posted: Mon Apr 25, 2005 4:53 pm Post subject: Styled Document and icons |
|
|
Hello,
Some problems with StyledDocument and icons: why subsequent calls to
insertIcon() with the same icon works improperly?
example:
ImageIcon icon1 = new ImageIcon("a.gif");
ImageIcon icon2 = new ImageIcon("b.gif");
StyledDocument doc = ...
// bad one - only one icon is inserted
doc.insertIcon(icon1);
doc.insertIcon(icon1);
// good one - inserts 2 icons
doc.insertIcon(icon1);
doc.insertIcon(icon2);
I tried to replace insertIcon() with insertString() and proper
AttributeSet, but results are the same.
Workaround, which i discover is:
- insert icon first time
- insert one char (space or whatever)
- delete this char
- insert icon second time
but this is 'little' weird.
Another question: lets assume that we have some text in document...
SimpleAttributeSet attr = new SimpleAttributeSet();
StyleConstants.setIcon(attr, someIcon);
doc.setCharacterAttributes(0, 2, attr, true);// first two characters
are replaced with icon
attr = new SimpleAttributeSet();
doc.setCharacterAttributes(0, 2, attr, true);// that's the question -
why icon *isn't* removed by this code?
Windows 2003 Server, Java 1.5
-----
greetz, KTB
|
|
| Back to top |
|
 |
Krzysztof Bink Guest
|
Posted: Tue Apr 26, 2005 9:48 am Post subject: Re: Styled Document and icons |
|
|
[email]usenet (AT) chka (DOT) de[/email] (Christian Kaufhold) wrote in message news:<0T25m9d3Ip4jNmc0 (AT) uni (DOT) chka.de>...
Thx for answers. Its looks like all this StyledDocument-related stuff
is rather buggy :(
|
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|