🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Re: Programming challenge!

#7950
From: David Jefferson
Date: Tue, 14 Nov 2000 00:00
57 lines
2769 bytes
Hi,
This is not that difficult a problem. In your DragGestureListener when you
override dragGestureRecognized you will call startDrag on the
DragGestureEvent, one of the parameters to this call is the Transferable
which is the contents of the drag drop. You can make this Transferable
contain an array of objects (I created a class which I called
SerializeableTransferable which implemented Transferable and contained an
array of Serialiazable objects).
Then in your DropTargetListener (in the destination of the drag drop)
remember when you get the data from the getTransferable method on
DropTargetDropEvent in the drop method that the data you will be receiving
is an array.

Of course you should probably define your own DataFlavor to cope with this.

Dave

"Stephen Legge" <stephen@cryptocard.com> wrote in message
news:8up6pl$i3a11@bornews.inprise.com...
> Hi John,
>
> I already did this, and dragging and dropping single items works great.
>
> The problem comes in when I want to multi-select a bunch of items in the
> JList and drag them all.
>
> If you could provide a sample showing it working with multiple items (or a
> detailed explaination) I would greatly appreciate it.  I am becoming
quickly
> convinced it can't be done, though. :-(
>
> Stephen Legge
>
>
> "John McGrath [TeamB]" <ng-b@JPMcGrath.net> wrote in message
> news:MPG.147569f8a6313a33989cef@forums.borland.com...
> > On Tue, 7 Nov 2000 16:32:42 -0500, Stephen Legge wrote:
> >
> > > I challenge anyone to implement a program that allows you
> > > to drag and drop multiple items from one JList to another
> > > (without getting an annoying circle-with-a-line-through
> > > it cursor when dropping).
> >
> > You need to recognize that the drag has entered your DropTarget using
> > a DropTargetListener, and then in the dragEnter() event, call the
> > acceptDrag() method on the DropTargetDragEvent.
> >
> > --
> > Regards,
> >
> > John McGrath [TeamB]
> >
> > ---------------------------------------------------
> > Before sending me e-mail, please read:
> >     http://www.JPMcGrath.net/newsgroups/e-mail.html
>
>
Technical Details
Message-ID: <3a113c1b_1@dnews>
Path: arc1-ca.pugleaf.net!unknown!not-for-mail
References: <8u9sju$l9n4@bornews.inprise.com> <MPG.147569f8a6313a33989cef@forums.borland.com> <8up6pl$i3a11@bornews.inprise.com>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 111d45,133fda11b6d1bea0
X-Google-Attributes: gid111d45,public
From: "David Jefferson" <david.jefferson@kbcfp.com>
Subject: Re: Programming challenge!
Date: 2000/11/14
Message-ID: <3a113c1b_1@dnews>
X-Deja-AN: 693466289
References: <8u9sju$l9n4@bornews.inprise.com> <MPG.147569f8a6313a33989cef@forums.borland.com> <8up6pl$i3a11@bornews.inprise.com>
X-Trace: 14 Nov 2000 05:20:27 -0800, 194.203.209.252
X-MSMail-Priority: Normal
X-Priority: 3
Newsgroups: borland.public.jbuilder.java.swing
X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2919.6700