🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.jbuilder.java.language
Article #16544

Re: newbe: Drag and Drop

#16544
From: Ones Self
Date: Wed, 10 Feb 1999 00:00
45 lines
2040 bytes

Vasudevan Srinivasan wrote:

> Hi,
> if you are using jdk1.1.x: i dont think drag n drop is implemented. you have
> also not mentioned whether you are dragging items intra-component or
> inter-component;
>
> assuming the later, in your situation what i would do is:
>
> //This is just a code to direct you - may not work "as is"; you may have to
> tweak n trim here and there
> //Step1. declare two components as memebers
> Object source, target;
> boolean bMousePressed=false;
>
> //Step2: capture mousePressed of source
> sourceComponent.addMouseListener(new java.awt.event.MouseAdapter() {
>     public void mousePressed(MouseEvent e) {
>         bMousePressed=true;
>         source = e.getSource();
>     }
> });
>
> //Step3: capture mouseRelease in target
> tgtComponent.addMouseListener(new java.awt.event.MouseAdapter() {
>     public void mouseReleased(MouseEvent e) {
>         if (bMousePressed) {
>             target = e.getSource();
>             // what ever you want to do
>         }
>     }
> });
>
> it is said the jdk1.2 supports dragndrop but no idea how far and how good
> Goodluck
> Vasu
>

I'm using jdk 1.1.6. I've tried to use your example but the truble is that when
the mouseReleased event
occurs the source component is the same as the source componet from the previuse
mousePressed
event. and there for I don't know which component got drop on.
Technical Details
Message-ID: <36C1F349.ACBE561C@usa.net>
Path: arc1-ca.pugleaf.net!unknown!not-for-mail
References: <36C09E34.63CBD27A@usa.net> <36C1FD77.9C7652EA@netrisk.com>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: f74b3,d37fb261fcea0d84
X-Google-Attributes: gidf74b3,public
From: Ones Self <oneself@usa.net>
Subject: Re: newbe: Drag and Drop
Date: 1999/02/10
Message-ID: <36C1F349.ACBE561C@usa.net>
X-Deja-AN: 443357502
Content-Transfer-Encoding: 7bit
References: <36C09E34.63CBD27A@usa.net> <36C1FD77.9C7652EA@netrisk.com>
To: Vasudevan Srinivasan <vasudevan@netrisk.com>
X-Accept-Language: en
Content-Type: text/plain; charset=us-ascii
Organization: Another Netscape Collabra Server User
Mime-Version: 1.0
Newsgroups: borland.public.jbuilder.java.language