Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / GUI / January 2005

Tip: Looking for answers? Try searching our database.

JTree as drop target:  use cell renderer ?

Thread view: 
roadkill - 30 Dec 2004 21:29 GMT
Hi all,

Can I use my custom cell renderer as a drop target ?
I was hoping to get access to the actual node dropped
on by something like this, instead of using the JTree
and getPathForLocation( x, y)...

I tried to use the cell renderer, and it doesn't work,
my guess would be that the JTree doesn't allow the
relevant events to propogate down far enough.
Any insights/recommendations ?
Thanks
Igor Buzatovic - 31 Dec 2004 08:10 GMT
> Hi all,
>
[quoted text clipped - 6 lines]
> my guess would be that the JTree doesn't allow the
> relevant events to propogate down far enough.

cell renderer is not really shown/ added to JTree as child component. It is
used only to paint cell region, but it is painting on JTree component.
That's why you can't attach drop or any other evenets to renderer, you have
to do it on Jtree component and then use getPathForLocation( x, y) to find
out which cell is relevant for the event. With all other mouse events like
mouse clicks, mouse moves etc. you have to use same method.

> Any insights/recommendations ?
> Thanks
roadkill - 02 Jan 2005 04:17 GMT
> > Hi all,
> >
> > Can I use my custom cell renderer as a drop target ?
>
> cell renderer is not really shown/ added to JTree as child component. It is
> used only to paint cell region, but it is painting on JTree component.

Ah, makes sense - thanks :)


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.