Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8124854

Gtk: Linux (Ubuntu 11.04 32 Bit): Accessing the contend of the Dragboard data during a drag and drop operation (setOnDragEntered, setOnDragOver) does not work as expected.

XMLWordPrintable

        Accessing the contend of the Dragboard data during a drag and drop operation (setOnDragEntered, setOnDragOver) does not work as expected.


        EXAMPLE (taken from HelloDragAndDrop.java example):

        target.setOnDragEntered(new EventHandler <DragEvent>() {
                    public void handle(DragEvent event) {

                        if (event.getGestureSource() != target && event.getDragboard().hasString()) {
                        

                            System.out.println(event.getDragboard().getString().toString()); //##############This will throw an NullPointer Exception.
                       
                            target.setFill(Color.GREEN);
                        }
                        
                        event.consume();
                    }
                });




                target.setOnDragOver(new EventHandler <DragEvent>() {
                    public void handle(DragEvent event) {

                        if (event.getGestureSource() != target && event.getDragboard().hasString()) {
                        
                         System.out.println(event.getDragboard().getString().toString()); //##############This will throw an NullPointer Exception.

                            event.acceptTransferModes(TransferMode.COPY_OR_MOVE);
                        }
                        
                        event.consume();
                    }
                });




        If the code is run on Windows, the error does not occur.

              azvegint Alexander Zvegintsev
              duke J. Duke
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

                Created:
                Updated:
                Resolved:
                Imported: