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 / December 2003

Tip: Looking for answers? Try searching our database.

how to determinate drag and drop in progress in JTree

Thread view: 
Dmitry R - 30 Dec 2003 23:24 GMT
I would like to provide auto node expansion in tree, when a user drags
something. How can I figure out that a node selected as result of
drag&drop?
Dmitry R - 31 Dec 2003 08:03 GMT
> I would like to provide auto node expansion in tree, when a user drags
> something. How can I figure out that a node selected as result of
> drag&drop?
It looks like a solution:

        try {
            getDropTarget().addDropTargetListener(new DropTargetAdapter() {
                // save restore need to be done only for a particular dnd
                public void dragEnter(DropTargetDragEvent dtde) {
                    dragInProgress = true;
                    selectedPaths = getSelectionPaths();
                }
                public void dragExit(DropTargetEvent dte) {
                    dragInProgress = false;
                }
                public void drop(DropTargetDropEvent dtde) {
                    dragInProgress = false;
                    setSelectionPaths(selectedPaths);
                }
                TreePath[] selectedPaths;
                });
        } catch (TooManyListenersException tmle) {
            // should not happen... swing drop target is multicast
        }


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.