🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.jbuilder.java.swing
Article #822

How to UnSelect a JTree?

#822
From: Ramon F Herrera
Date: Sun, 25 Jul 2004 02:21
23 lines
1722 bytes
I have a problem with JTrees: the user can click away
selecting a set of paths (with the usual <shift> and
<control> keys) but there is no click method that will
restore the tree to its original, pristine, unselected
state.

What I would like to implement is the familiar Mac and
Windows icon selection: when the user clicks on the
desktop all the file icons become unselected.

I figured out how to perform the actual unselection:

     rightTree.setSelectionPath(null);

However, I don't know what event should trigger the above
response.  The only Tree Listener seems to be 'valueChanged'
which is fired only when one of the folders is clicked.

How can I detect a click on the background of a tree??

TIA,

-Ramon F Herrera
Technical Details
Message-ID: <41031939$1@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!news.glorb.com!newsfeed00.sul.t-online.de!t-online.de!news-lei1.dfn.de!news-ber1.dfn.de!fu-berlin.de!newsfeed.iinet.net.au!newsfeed.iinet.net.au!PeerFeed.KWeb.on.ca!news.kweb.on.ca!newsgroups.borland.com!not-for-mail

Show Full Headers
Complete Article Headers
X-Google-Thread: 111d45,2aac51bc857db07c,start
X-Google-Attributes: gid111d45,public
X-Google-Language: ENGLISH,ASCII-7-bit
Date: Sat, 24 Jul 2004 22:21:42 -0400
From: Ramon F Herrera <ramon@jonjay.com>
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.4) Gecko/20030624 Netscape/7.1 (ax)
X-Accept-Language: en-us, en
MIME-Version: 1.0
Newsgroups: borland.public.jbuilder.java.swing
Subject: How to UnSelect a JTree?
Content-Type: text/plain; charset=us-ascii; format=flowed
Content-Transfer-Encoding: 7bit
NNTP-Posting-Host: 24.61.5.41
Message-ID: <41031939$1@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1090722105 24.61.5.41 (24 Jul 2004 19:21:45 -0700)
Lines: 26
Path: arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!news.glorb.com!newsfeed00.sul.t-online.de!t-online.de!news-lei1.dfn.de!news-ber1.dfn.de!fu-berlin.de!newsfeed.iinet.net.au!newsfeed.iinet.net.au!PeerFeed.KWeb.on.ca!news.kweb.on.ca!newsgroups.borland.com!not-for-mail