Article View: borland.public.jbuilder.java.swing
Article #8081JButton in a drag-and-drop operation
From: Philippe Trottier
Date: Thu, 23 Nov 2000 00:00
Date: Thu, 23 Nov 2000 00:00
27 lines
1568 bytes
1568 bytes
Hi, I am currently using a class derived from JButton as a drag and drop object: public class DnDButton extends JButton implements DragSourceListener, DragGestureListener I also made a drop target: public class DroppableLabel extends JLabel implements DropTargetListener And a transferable object: public class ButtonTransfer implements Transferable The DnD operation works for the most part except that sometimes the button will be pressed after the DnD and will remain that way until the user clicks on it. What could i do (possibly in the dragDropEnd(DragSourceDropEvent e) method) to set the button state back to normal? Also, i have a custom mouse listener on every DnDButton (derived from JButton see above). I listen to single clicks and double- clicks (getClickCount() == 2). However, most of the time, the double click event is ignored and results in a single click action. What could i do to go around this problem? Can i set the delay between a single and double-click event? Thank you, Philippe Trottier
Technical Details
Message-ID:
<3a1d7ca4$1_2@dnews>Path:
arc1-ca.pugleaf.net!unknown!not-for-mailShow Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 111d45,9e92e48dd1c15db7,start X-Google-Attributes: gid111d45,public From: "Philippe Trottier" <philippe.trottier@simplernetworks.com> Subject: JButton in a drag-and-drop operation Date: 2000/11/23 Message-ID: <3a1d7ca4$1_2@dnews> X-Deja-AN: 697181605 X-Trace: 23 Nov 2000 12:23:00 -0800, 216.191.3.122 X-MSMail-Priority: Normal X-Priority: 3 Newsgroups: borland.public.jbuilder.java.swing X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4133.2400