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 

paint visited leaf's in JTree

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





PostPosted: Sat May 13, 2006 10:07 am    Post subject: paint visited leaf's in JTree Reply with quote



is it possible to paint (in red for example) .
visited leafs of a JTree ?
Thank you
Sharon
Back to top
Oliver Wong
Guest





PostPosted: Sat May 13, 2006 9:07 pm    Post subject: Re: paint visited leaf's in JTree Reply with quote



"Sharon" <Sharon669 (AT) hotmail (DOT) com> wrote in message
news:4465a2f9 (AT) news (DOT) bezeqint.net...
Quote:
is it possible to paint (in red for example) .
visited leafs of a JTree ?

Yes. You'd design your model to keep track of which nodes were visited,
and provide a custom renderer for the tree.

- Oliver
Back to top
Sharon
Guest





PostPosted: Sun May 14, 2006 9:07 pm    Post subject: Re: paint visited leaf's in JTree Reply with quote



Hi Oliver and thank you

I have custom renderer , and I have a HashMap that saves the path of the
visited Leaf

But how dose the actual painting occurs?



Thanks again

Sharon



"Oliver Wong" <owong (AT) castortech (DOT) com> wrote in message
news:0Sr9g.11856$Qq.9267@clgrps12...
Quote:

"Sharon" <Sharon669 (AT) hotmail (DOT) com> wrote in message
news:4465a2f9 (AT) news (DOT) bezeqint.net...
is it possible to paint (in red for example) .
visited leafs of a JTree ?

Yes. You'd design your model to keep track of which nodes were visited,
and provide a custom renderer for the tree.

- Oliver
Back to top
Daniel
Guest





PostPosted: Mon May 15, 2006 6:07 am    Post subject: Re: paint visited leaf's in JTree Reply with quote

If you have you already have your custom renderer it should be no
problem.
You have your method getTreeCellRendererComponent( ... )
in there you can either ask the tree for the model, "talk to" the
model some other way. if you just extend the DefaultTreeCellRenderer
it is a JLabel, so there you can change the colour easily.

something like
if(visited){
super.setForeground(ColorRED);
}else{
super.setForeground(Color.BLUE);
}

regards
Daniel


Quote:
Hi Oliver and thank you

I have custom renderer , and I have a HashMap that saves the path of the
visited Leaf

But how dose the actual painting occurs?



Thanks again

Sharon



"Oliver Wong" <owong (AT) castortech (DOT) com> wrote in message
news:0Sr9g.11856$Qq.9267@clgrps12...

"Sharon" <Sharon669 (AT) hotmail (DOT) com> wrote in message
news:4465a2f9 (AT) news (DOT) bezeqint.net...
is it possible to paint (in red for example) .
visited leafs of a JTree ?

Yes. You'd design your model to keep track of which nodes were visited,
and provide a custom renderer for the tree.

- Oliver
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.