🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.jbuilder.java.api
Article #2691

Re: mouse motion with drag 'n drop

#2691
From: Joe Fessler
Date: Tue, 06 Jun 2000 00:00
52 lines
3132 bytes
You're pretty close John.  I'm not needing (yet) to move either the
component, or its wrapped object, from one container to another... all the
moving takes place within the context of a single JPanel.  I originally
intended the dnd listeners to handle the "transmission" of the wrapped
object from one JButton component to another (again in the same JPanel).
The mousemotionlistener was then introduced so that the individual JButtons
could be physically repositioned in their containing JPanel.  If I use dnd
to address not only the transmission of the wrapped object, but also the
repositioning of the JButtons, then the JButtons need to be "transferable"
too - no?... with the JPanel being a drop target.  Yet, how to determine
the intent of the user - transfer the object vs. repositioning of the
component.

So, the more this problem molds over in my head, I'm thinking I need the
user to explicitly switch modes so that the appropriate listeners can be
turned on/off.  This seems kind of klunky though... plus the overhead of
adding and removing listeners.  It's not elegant.

-J

"John P. McGrath" wrote:

> On Mon, 05 Jun 2000 10:02:24 -0500, Joe Fessler wrote:
>
> > To rephrase and explain, I'm using an extension of JButton
> > which wraps another object.  Using dnd, I can move the
> > wrapped object from component to component, and using
> > mousemotionlistener I can physically reposition the
> > extended JButton(s) in the JPanel.  My efforts to combine
> > the two operations have not been too successful.  It seems
> > that the motionlistener grabs the first few motion events
> > and then the dnd listeners kick in.  This effect makes
> > perfect sense, but I'm looking for a way to implement both
> > pieces of functionality.
>
> If I understand correctly, you are trying to create two different
> mechanisms, both that can move the component.  You are using drag and
> drop to move a component from one container to another, and another to
> move the component within the container.  Is this correct?
>
> If so, I think you will run into problems with this approach.  You have
> two listeners (yours and the drag-and-drop mechanism), and both may try
> to move the component in response to the same mouse gestures.
>
> Is there some reason that you cannot handle moving within the container
> using the drag-and-drop mechanism as well?  I can't think of any reason
> that should not work.
>
> --
> John P. McGrath
> <JPMcGrath@fast.net>
> <jpm@nscs.fast.net>
Technical Details
Message-ID: <393D290C.ED9F9FC7@idir.net>
Path: arc1-ca.pugleaf.net!unknown!not-for-mail
References: <393BC100.87AF3EB7@idir.net> <MPG.13a63b62a555a9e989990@forums.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 1089d0,7648534fe4fd6be3
X-Google-Attributes: gid1089d0,public
From: Joe Fessler <jfessler@idir.net>
Subject: Re: mouse motion with drag 'n drop
Date: 2000/06/06
Message-ID: <393D290C.ED9F9FC7@idir.net>
X-Deja-AN: 631793548
Content-Transfer-Encoding: 7bit
References: <393BC100.87AF3EB7@idir.net> <MPG.13a63b62a555a9e989990@forums.borland.com>
X-Accept-Language: en,pdf
Content-Type: text/plain; charset=us-ascii
X-Trace: 6 Jun 2000 09:35:40 -0800, 209.172.222.208
MIME-Version: 1.0
Newsgroups: borland.public.jbuilder.java.api