Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Java > JTree and those small Icons ahead folder, file etc icons.

Reply
Thread Tools

JTree and those small Icons ahead folder, file etc icons.

 
 
Richie Williams
Guest
Posts: n/a
 
      10-25-2007
Hello,

How can I remove those small icons that comes to front of each node
that are in JTree. I mean those small images that looks like hanheld mirros
or something.
I want lines connecting each node to it's parent and folder and leaf icon
but icon that
I mentioned I gladly remove.

I have seen a snippet how to remove them but can't find it anywhere.

Can anyone help?

Cheers!


 
Reply With Quote
 
 
 
 
Richie Williams
Guest
Posts: n/a
 
      10-25-2007
To clarify I like get rid of those icon that Windows Tree contol shows plus
sign.

"Richie Williams" <(E-Mail Removed)> wrote in message
news:ffqcpc$rae$(E-Mail Removed)...
> Hello,
>
> How can I remove those small icons that comes to front of each node
> that are in JTree. I mean those small images that looks like hanheld
> mirros or something.
> I want lines connecting each node to it's parent and folder and leaf icon
> but icon that
> I mentioned I gladly remove.
>
> I have seen a snippet how to remove them but can't find it anywhere.
>
> Can anyone help?
>
> Cheers!
>



 
Reply With Quote
 
 
 
 
Daniel Dyer
Guest
Posts: n/a
 
      10-25-2007
On Thu, 25 Oct 2007 16:36:50 +0100, Richie Williams
<(E-Mail Removed)> wrote:

> Hello,
>
> How can I remove those small icons that comes to front of each node
> that are in JTree. I mean those small images that looks like hanheld
> mirros
> or something.
> I want lines connecting each node to it's parent and folder and leaf icon
> but icon that
> I mentioned I gladly remove.
>
> I have seen a snippet how to remove them but can't find it anywhere.
>
> Can anyone help?


The answer is in the API documentation:

http://java.sun.com/j2se/1.5.0/docs/...andles(boolean)

Dan.

--
Daniel Dyer
http://www.uncommons.org
 
Reply With Quote
 
Richie Williams
Guest
Posts: n/a
 
      10-25-2007

"Daniel Dyer" <"You don't need it"> wrote in message
news(E-Mail Removed)...
> On Thu, 25 Oct 2007 16:36:50 +0100, Richie Williams
> <(E-Mail Removed)> wrote:
>
>> Hello,
>>
>> How can I remove those small icons that comes to front of each node
>> that are in JTree. I mean those small images that looks like hanheld
>> mirros
>> or something.
>> I want lines connecting each node to it's parent and folder and leaf icon
>> but icon that
>> I mentioned I gladly remove.
>>
>> I have seen a snippet how to remove them but can't find it anywhere.
>>
>> Can anyone help?

>
> The answer is in the API documentation:
>
> http://java.sun.com/j2se/1.5.0/docs/...andles(boolean)
>
> Dan.
>
> --
> Daniel Dyer
> http://www.uncommons.org


Sorry but did not find answer there but it seems to be so that code like
below:

JTree tree = new JTree(root);

ComponentUI treeUI = tree.getUI();
if(treeUI instanceof BasicTreeUI)
{
((BasicTreeUI) treeUI).setExpandedIcon(null);
((BasicTreeUI) treeUI).setCollapsedIcon(null);
}

Make my day!

Cheers!


 
Reply With Quote
 
Daniel Dyer
Guest
Posts: n/a
 
      10-25-2007
On Thu, 25 Oct 2007 17:33:56 +0100, Richie Williams
<(E-Mail Removed)> wrote:
>
> Sorry but did not find answer there but it seems to be so that code like
> below:
>
> JTree tree = new JTree(root);
>
> ComponentUI treeUI = tree.getUI();
> if(treeUI instanceof BasicTreeUI)
> {
> ((BasicTreeUI) treeUI).setExpandedIcon(null);
> ((BasicTreeUI) treeUI).setCollapsedIcon(null);
> }
>


Which "thing" are you trying to hide? If you want to hide the control on
the very left that expands/collapses the branches, then you use
setShowsRootHandles. If you want hide the folder/file icons that are
rendered for each node, then your code is a solution for that.

Dan.

--
Daniel Dyer
http://www.uncommons.org
 
Reply With Quote
 
Richie Williams
Guest
Posts: n/a
 
      10-25-2007

"Daniel Dyer" <"You don't need it"> wrote in message
news(E-Mail Removed)...
On Thu, 25 Oct 2007 17:33:56 +0100, Richie Williams
<(E-Mail Removed)> wrote:
>
> Sorry but did not find answer there but it seems to be so that code like
> below:
>
> JTree tree = new JTree(root);
>
> ComponentUI treeUI = tree.getUI();
> if(treeUI instanceof BasicTreeUI)
> {
> ((BasicTreeUI) treeUI).setExpandedIcon(null);
> ((BasicTreeUI) treeUI).setCollapsedIcon(null);
> }
>


>Which "thing" are you trying to hide? If you want to hide the control on
>the very left that expands/collapses the branches, then you use
>setShowsRootHandles. If you want hide the folder/file icons that are
>rendered for each node, then your code is a solution for that.
>
>Dan.
>
>
>--
>Daniel Dyer
>http://www.uncommons.org


Hello,

Yep I was using hiding for the latter situation you mentioned.
In my case those collapse icons were not suitable for GUI
because they looked peculiar in my LookAndFeel.
I handle folders with folder open / close icons.

Of course I also changed the color or the lines connecting
each node to their parents.

Seems good now!

Cheers!



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: PIL (etc etc etc) on OS X Kevin Walzer Python 4 08-13-2008 08:27 AM
icons in jtree Bumsys@gmail.com Java 1 02-19-2008 11:32 AM
JTree Selection lost when JTree looses focus jumpz Java 3 11-12-2007 03:55 PM
Good news to all those who are seeking for job in dotnet(Only those who are leaving in Hyderabad -India) BinnuChowdary ASP .Net 1 05-01-2006 01:03 PM
custom JTree icons Brandon McCombs Java 4 01-14-2006 06:48 PM



Advertisments