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 / October 2007

Tip: Looking for answers? Try searching our database.

drag'n drop: why does the parent also become a droptarget

Thread view: 
marcussilfver@gmail.com - 23 Oct 2007 11:56 GMT
I am completely new to implementing drag and drop.

I have made a class called DropPanel that extends JPanel. DropPanel
implements the DropTargetListener interface. I place a DropPanel as a
component of a JPanel and executes my application...

The wierd thing is that my dropPanel.drop method is called even if I
drop the draggable outside my DropPanel (on the JPanel that contains
the DropPanel).

This behaviour forces me to do a check in my drop method for the
dropPanel's bounds and compare this with the mouse position and reject
the drop if it is outside dropPanel.

Is it supposed to be like this?
Andrew Thompson - 23 Oct 2007 12:37 GMT
>I am completely new to implementing drag and drop.
...
>This behaviour forces me to do a check in my drop method for the
>dropPanel's bounds and compare this with the mouse position and reject
>the drop if it is outside dropPanel.
>
>Is it supposed to be like this?

From my vague recollection of implementing D'n'D in
an animated Gif project, that is wrong.  Originally I
had added the drop listener to an 'image list' on the
left of the GUI - but decided it made sense to allow
images to be dropped anywhere in the GUI.  AFAIR
I had to move the drop listener to the frame to allow
the user to 'drop anywhere'.

Have you got an SSCCE that shows this behaviour?

Signature

Andrew Thompson
http://www.athompson.info/andrew/

marcussilfver@gmail.com - 24 Oct 2007 06:51 GMT
> marcussilf...@gmail.com wrote:
> >I am completely new to implementing drag and drop.
[quoted text clipped - 14 lines]
>
> Have you got an SSCCE that shows this behaviour?

Thanks for answering. What is a SSCCE?
Andrew Thompson - 24 Oct 2007 08:56 GMT
>> marcussilf...@gmail.com wrote:
>> >...drag and drop.
...
>> Have you got an SSCCE that shows this behaviour?
>
>Thanks for answering. ..

You're welcome.

>..What is a SSCCE?

Huh.  I thought you were a regular on the group when
I failed to include the link, but noticing you are a GG
poster, I'll try to lead you to it via other means.

Try this search..
http://groups.google.com/group/search?group=comp.lang.java.gui&q=sscce>

Signature

Andrew Thompson
http://www.athompson.info/andrew/

marcussilfver@gmail.com - 26 Oct 2007 08:15 GMT
> marcussilf...@gmail.com wrote:
> >> marcussilf...@gmail.com wrote:
[quoted text clipped - 18 lines]
>
> Message posted viahttp://www.javakb.com

I found the problem. I sent in the droptarget for both arguments to
setDropTarget. Like setDropTarget (new DropTarget(dropPanel,
dropPanel).

Thanks for your time with this.


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.