Hello, I have set up a Drag and Drop feature in my app using the java.awt.dnd package. It all works well but for the drag image.. it just won't display. Here's the piece of code covering the drag image: public class DragListener implements DragGestureListener { public DragListener(Component component) { this.component = component; } public void dragGestureRecognized(DragGestureEvent dge) { BufferedImage image = null; try { image = ImageIO.read(new File("images/bin.png")); } catch (IOException e) { e.printStackTrace(); } dge.startDrag(new Cursor(Cursor.CROSSHAIR_CURSOR), image, new Point(0, 0), new TransferComponent(component), new DragSourceAdapter() { @Override public void dragEnter(DragSourceDragEvent e) { } }); } private Component component; } Code (markup): Tia
Following your link, under 'Implementing the DragGestureListener Interface', can you tell me what the implementation of the 'drawDragImage(Graphics g)' method would be like? Because that's the key line to the solution...
That bug is 7 years old. You're reading the image, but not drawing it on screen. What are you exactly trying to do?