AppletTalk.com Forum Index AppletTalk.com
Java discussions newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Styled Document and icons

 
Post new topic   Reply to topic    AppletTalk.com Forum Index -> Java GUI Toolkits
View previous topic :: View next topic  
Author Message
Krzysztof Bink
Guest





PostPosted: Mon Apr 25, 2005 4:53 pm    Post subject: Styled Document and icons Reply with quote



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





PostPosted: Tue Apr 26, 2005 9:48 am    Post subject: Re: Styled Document and icons Reply with quote



[email]usenet (AT) chka (DOT) de[/email] (Christian Kaufhold) wrote in message news:<0T25m9d3Ip4jNmc0 (AT) uni (DOT) chka.de>...

Quote:
...

Thx for answers. Its looks like all this StyledDocument-related stuff
is rather buggy :(

Back to top
Display posts from previous:   
Post new topic   Reply to topic    AppletTalk.com Forum Index -> Java GUI Toolkits All times are GMT
Page 1 of 1

 
Jump to:  
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


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.