Velocity Reviews

Velocity Reviews (http://www.velocityreviews.com/forums/index.php)
-   Java (http://www.velocityreviews.com/forums/f30-java.html)
-   -   Testing JTree setSelectionPath(TreePath path)? (http://www.velocityreviews.com/forums/t139684-testing-jtree-setselectionpath-treepath-path.html)

carlg@libertybasic.com 01-03-2005 03:40 AM

Testing JTree setSelectionPath(TreePath path)?
 
How can I tell if a call to JTree setSelectionPath(TreePath path) fails
because of an invalid path? I have a search function set up which
stores TreePaths. While browsing the TreePaths I choose one or more
and when I do, I expand the chosen TreePath (using setSelectionPath())
and select the TreeNode. This works great. Now, if the structure of
the tree changes, I want to be able to know that my attempt at
setSelectionPath() didn't work. I thought that perhaps getting the
selected object after calling setSelectionPath() and testing for null
would work, but instead it returns what seems to be the object at the
bottom of the TreePath I attempted to use to set the selection in the
first place.

Any ideas? Is there a path validation function I'm overlooking?

Thanks,
-Carl Gundel, author of Liberty BASIC
http://www.libertybasic.com


Andrew Thompson 01-03-2005 04:02 AM

Re: Testing JTree setSelectionPath(TreePath path)?
 
On 2 Jan 2005 19:40:35 -0800, carlg@libertybasic.com wrote:

> How can I tell if a call to JTree ...


GUI experts are best found at..
<http://www.physci.org/codes/javafaq.jsp#cljg>

--
Andrew Thompson
http://www.PhySci.org/codes/ Web & IT Help
http://www.PhySci.org/ Open-source software suite
http://www.1point1C.org/ Science & Technology
http://www.LensEscapes.com/ Images that escape the mundane


All times are GMT. The time now is 02:48 PM.

Powered by vBulletin®. Copyright ©2000 - 2014, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.