Javafx 2.1: Drag and Drop issue (Mac)

Hi all,
As I related in other question I've posted here today, I'm having some problems when running my code which worked on windows now that I'm on a mac. This one is related to drag and drop, it used to work on windows (Write once, debug everywhere!) but now the onDragDropped event is not being fired. Here's the code. Any help is appreciated. Thanks in advance
          HRWindowGridPane.setOnDragEntered(new EventHandler<DragEvent>() {
               @Override
               public void handle(DragEvent event) {
                    System.out.println("Drag entered");
                    lblPhoto.setEffect(finalBlend);
                    event.consume();
          HRWindowGridPane.setOnDragExited(new EventHandler<DragEvent>() {
               @Override
               public void handle(DragEvent event) {
                    lblPhoto.setEffect(null);
                    System.out.println("Drag exited");
                    event.consume();
          EventHandler<DragEvent> onDragOver = new EventHandler<DragEvent>() {
          public void handle(DragEvent event) {
          /* data is dragged over the target */
          /* accept it only if it is not dragged from the same node
          * and if it has a string data */
          if (event.getGestureSource() != HRWindowGridPane &&
          event.getDragboard().hasFiles()) {
          /* allow for both copying and moving, whatever user chooses */
          event.acceptTransferModes(TransferMode.ANY);
          System.out.println("Drag over");
          event.consume();
          HRWindowGridPane.setOnDragOver(onDragOver);
          HRWindowGridPane.setOnDragDropped(new EventHandler<DragEvent>()
               @Override
               public void handle(DragEvent event)
                    System.out.println("Drag dropping");
                    Dragboard db = event.getDragboard();
                    System.out.println("Drag dropped: got dragboard from event!");
                    if(db.hasFiles())
                         System.out.println("Drag dropped: dragboard has files!");
                         for(File file:db.getFiles())
                    if(file.getName().contains(".jpg") || file.getName().contains(".jpeg") || file.getName().contains(".JPG"))
                         Image img;
                                   try
                                        System.out.println("Everything is fine until image processing... hmmm");
                                        img = new Image(file.toURI().toURL().toString(), 118.0, 88.0, false, true);
                                        ImageView view = new ImageView(img);
                                        view.setFitWidth(118.0);
                                        view.setFitHeight(88.0);
                                        view.resize(118.0, 88.0);
                                        lblPhoto.setGraphic(view);
                                        avatarImage = file;
                                   catch (IOException e)
                                        e.printStackTrace();
                    else
                         AlertWindow alert = new AlertWindow("Falha", "O Arquivo não é uma imagem JPG válida");
                         try
                              Stage stage = new Stage();
                                        alert.start(stage);
                                        stage.toFront();
                                        HRWindowGridPane.toBack();
                                        stage.centerOnScreen();
                                        stage.show();
                                   } catch (Exception e) {
                                        e.printStackTrace();
                    event.setDropCompleted(true);
                    event.consume();
          HRWindowGridPane.setOnDragDone(new EventHandler<DragEvent>() {
               @Override
               public void handle(DragEvent event)
                    System.out.println("Drag done");
          });

Hi,
I submitted this bug a while ago (http://javafx-jira.kenai.com/browse/RT-20253) hopefully it will be solved soon.
Andy

Similar Messages

  • How do you drag and drop using mac laptop?

    how do you drag and drop using mac laptop?

      As said above, you can click down, ons use the other finger to drag the object.  I had turned on the setting to use three-finger drag, so you can drag objects with three fingers.  To change gesture settings, go to the system preferences>trackpad.  Here you can also see all of the gestures of Mac OS X.

  • Mail attachment drag and drop issue

    Been facing serious mail attachment drag-and-drop issue since 10.8 (if not from 10.7) and was disappointed to find the same behaviour still in 10.9.
    When I drag and drop a picture file (from Finder for example) into a message window or onto the Mail.app Dock icon, the system's window management somehow gets confused: my next step is to click on the message window in order to start typing. However, the mouse click causes that very window to escape under all other open applications / windows. Further on, I dig under to find the escapee and click again: once more it escapes. This can go on for a few annoying rounds until gets solved in an unexplainable way. This behaviour in not consistent, but has happens in about 8 cases out of 10.
    Apart from Mail.app I do not experience drag and drop issues of any kind.
    Anyone else suffering from this?

    I'd be interested in the answer to this too.
    It only just started happening to me a day or so ago, about the time that I think I did an OS upgrade.
    I'm on OSX 10.8.2.
    Its annoying.
    I can drop and drag in Finder but it just affects email.

  • Drag and Drop issue from Explorer folder to Music Library

    Hello
    I just updated my iTunes to 8.0.0.20 but something unexpected happened. I can’t drag and drop anymore songs from an explorer folder into my music library when my view mode is set to Grid (Album, Artist, Genre or Composer).
    When I try I have a kind of interdiction circle under my pointer.
    I can only perform this operation in list mode view. Few hours ago it was still possible to perform it but not after I updated. I reinstalled my iTunes but the problem persists.
    I have read the forums I know I can add to my playlist as usual by using the menu. But is it possible to get drag and drop operation when I drags song directly from a folder on my explorer window?
    It would be very appreciated if someone has an answer. I really messed up my library trying to fix this

    I fixed the drag and drop issues I had! Turns out they were caused by the permission problems of Vista. To fix it I just made sure all the files in the iTunes folder and sub folders were full control by my account.
    Make sure you check the properties of the iTunes database specifically because before, the iTunes folder had the correct permissions but they hadn't actually been inherited correctly by the iTunes DB files. Hope this helps anyone else.

  • Drag and drop issue alternatives

    Hello
    i'm having the same drag and drop issue as the other guys here. basically cant drag and drop to the desktop. Im looking for a workaround that doesnt involve making temporary backups or repairing iphoto libraries. My library is 260gb and even though it is being backed up i dont have a spare 260gb.

    That does not exist - the workaround (maybe permanent solution - who knows) is
    File menu ==> export
    And BTW if you are not backingup all the time you are 100% guarenteed to lose all of your files and photos sooner or later
    LN

  • Drag and drop issues 10.7.2 Mac OS X .. what do I do?

    Drag and Drop ain't working ... 2,3 Ghz Intel Core i5

    Please provide more details and/or examples.
    Ciao.

  • Drag and drop issue: got an exception

    Hi there,
    I'm facing a problem with drag and drop. Basically I try to drag an AnchorPane (and all its children), representing a sticky note, from an AnchorPane to another. While trying to do it I got an exception. I followed some steps from the Oracle's documentation, but didn't help me.
    I created a method that reacts on the DRAG_DETECTED event which is the following:
    @FXML private void stickyDragDetected(MouseEvent event) {
      System.out.println("Drag detected");
      Dragboard db = ((Node) event.getSource()).startDragAndDrop(TransferMode.COPY_OR_MOVE);
      ClipboardContent cc = new ClipboardContent();
      cc.put(new DataFormat(PojoTask.class.getName()), task.get().convertToPojo());
      db.setContent(cc);
      event.consume();
      System.out.println("End drag detected");
    }Some explanations:
    - PojoTask a simple Pojo without any properties (because they're not serializable)
    - The variable task is declared like this: ObjectProperty<Task> task = new SimpleObjectProperty<Task>();
    - Task is a class similar to PojoTask but with properties
    - I use the PojoTask's class name because it's a custom drag'n'drop
    When I drag the AnchorPane, i got this exception, repeated multiple times (and nothing else):
    Glass detected outstanding Java exception at -[GlassViewDelegate sendJavaDndEvent:type:]:src/com/sun/mat/ui/GlassViewDelegate.m:774
    Exception in thread "JavaFX Application Thread" java.lang.IllegalArgumentException: PrismEventUtils.convertToTransferMode: ambiguous drop action: 3
         at com.sun.javafx.tk.quantum.PrismEventUtils.convertToTransferMode(PrismEventUtils.java:193)
         at com.sun.javafx.tk.quantum.PrismEventUtils.glassDragEventToFX(PrismEventUtils.java:147)
         at com.sun.javafx.tk.quantum.PrismEventUtils.glassDragSourceEventToFX(PrismEventUtils.java:167)
         at com.sun.javafx.tk.quantum.QuantumToolkit.convertDragSourceEventToFX(QuantumToolkit.java:1141)
         at javafx.scene.Scene$DragSourceListener.dragDropEnd(Scene.java:2971)
         at com.sun.javafx.tk.quantum.GlassSceneDnDEventHandler.handleDragEnd(GlassSceneDnDEventHandler.java:199)
         at com.sun.javafx.tk.quantum.GlassViewEventHandler.handleDragEnd(GlassViewEventHandler.java:420)
         at com.sun.glass.ui.View.handleDragEnd(View.java:685)
         at com.sun.glass.ui.View.notifyDragEnd(View.java:990)
         at com.sun.glass.ui.mac.MacPasteboard._putItemsFromArray(Native Method)
         at com.sun.glass.ui.mac.MacPasteboard.putItemsFromArray(MacPasteboard.java:148)
         at com.sun.glass.ui.mac.MacPasteboard.putItems(MacPasteboard.java:176)
         at com.sun.glass.ui.mac.MacSystemClipboard.pushToSystem(MacSystemClipboard.java:248)
         at com.sun.glass.ui.SystemClipboard.flush(SystemClipboard.java:28)
         at com.sun.glass.ui.ClipboardAssistance.flush(ClipboardAssistance.java:34)
         at com.sun.javafx.tk.quantum.QuantumClipboard.flush(QuantumClipboard.java:196)
         at com.sun.javafx.tk.quantum.QuantumToolkit.startDrag(QuantumToolkit.java:1189)
         at javafx.scene.Scene$DnDGesture.dragDetectedProcessed(Scene.java:2648)
         at javafx.scene.Scene$DnDGesture.process(Scene.java:2709)
         at javafx.scene.Scene$DnDGesture.access$8700(Scene.java:2603)
         at javafx.scene.Scene$MouseHandler.process(Scene.java:3340)
         at javafx.scene.Scene$MouseHandler.process(Scene.java:3164)
         at javafx.scene.Scene$MouseHandler.access$1900(Scene.java:3119)
         at javafx.scene.Scene.impl_processMouseEvent(Scene.java:1559)
         at javafx.scene.Scene$ScenePeerListener.mouseEvent(Scene.java:2261)
         at com.sun.javafx.tk.quantum.GlassViewEventHandler.handleMouseEvent(GlassViewEventHandler.java:228)
         at com.sun.glass.ui.View.handleMouseEvent(View.java:528)
         at com.sun.glass.ui.View.notifyMouse(View.java:922)If i remove in my method everything that deals with the ClipboardContent I don't get the exception (but of course nothing is dragged). I also tried provided DataFormats, as well as trying to only pass a String as value for the ClipboardContent, but I still get the exception.
    Does anybody have an idea? Thanks!
    PS: I'm running on OS X 10.7.5, with JDK7u10 (with JavaFX 2.2.4).

    That does not exist - the workaround (maybe permanent solution - who knows) is
    File menu ==> export
    And BTW if you are not backingup all the time you are 100% guarenteed to lose all of your files and photos sooner or later
    LN

  • Drag and drop issues.  I'm not alone.

    So clearly I'm not the only one dealing with this, I've seen other topics with people running into this problem.
    All of a sudden last night I was unable to drag and drop stuff around, copy and past, run a new program and I have no Spotlight. I've restarted Finder, the whole Mac, reset the PRAM, and even rand DU and repaired the disk. Nothing. Stil can't do stuff on it, and it's starting to get on my nerves.
    Does anyone know of a solution to this? I've read many "temporary fixes" that haven't done anything for me.
    Thanks!

    Inaki wrote:
    So clearly I'm not the only one dealing with this, I've seen other topics with people running into this problem.
    All of a sudden last night I was unable to drag and drop stuff around, copy and past, run a new program and I have no Spotlight. I've restarted Finder, the whole Mac, reset the PRAM, and even rand DU and repaired the disk. Nothing. Stil can't do stuff on it, and it's starting to get on my nerves.
    When you say, "All of a sudden" what were you doing on the computer? Do you have any 3rd party software installed. Any recent installs?
    Does anyone know of a solution to this? I've read many "temporary fixes" that haven't done anything for me.
    Create a new user and see if the problem exists with the new user. If not, then you most likely have a corrupted .plist or other file.
    If the problem exists with the new user, then it's a deeper issue - more system related.
    Your topic is a bit misleading - you have multiple issues - spotlight and the inability to run a new program. Is it possible that this new program is the problem?
    Message was edited by: nerowolfe

  • Problem with drag and drop on Mac

    Hi, when I run my AIR application on Windows, I'm able to do
    the drag and drop.
    But when I run the application on Mac, it gave me an
    allocation error: unable to allocate region of size <random
    number> after I drag and drop thrice.
    Anybody knows what's the reason?

    Pages does not support the Apple font used for color emoji, so that behavior is normal.
    With what app are you reading the yahoo mail?  There is really no guarantee than any other email service will show the special Apple font involved.
    You should have no problem putting emoji directly into Mail or Text edit via drag drop from the Character Viewer as shown below.
    You should also be able to upload graphics here easily by clicking on the camera icon.  My email is tom at bluesky dot org.

  • Drag and drop issue, please help.

    I can no longer drag and drop photos within photoshop elements 12.  When working with a layer, I want to move it to a layer within another existing file, and no longer have the option.  The only way I have fixed the issue in the past is uninstall and reinstall the program.  I've read other forum posts and followed the instructions by resetting preferences and it does not work.
    Does anyone have any solutions to this issue?  Please help!

    With both files open, simplest to tile them side by side, you should be able to drag the layer from the source file onto the target file. So long as it shows the 'grasping hand' you can release the mouse and it should add the layer to the target.
    So what is happening now on your system? When you drag the layer to the target what icon is shown - 'grasping hand', 'no entry', something else?
    Cheers,
    Neale
    Insanity is hereditary, you get it from your children
    If this post or another user's post resolves the original issue, please mark the posts as correct and/or helpful accordingly. This helps other users with similar trouble get answers to their questions quicker. Thanks.

  • Drag and Drop Q10 Mac

    Using Blackberry Link on for Mac - I want to drag and drop a video file from Q10 to Mac Desktop. Does not work. When I "right click" mouse over a video file, it gives option to "copy to desktop." This feature does not work.

    Thanx. I tried with the different overloaded startDrag() which allows an image to be set.
    As my requirement is such that I do not want any image to be shown aruond next to cursor, so I set Image field to null.
    On windows it does not show any block (Image) but on Mac it does :(.

  • Wacky Drag and Drop issue with JNLP

    I'm sure I'll have to be a bit more descriptive but I'll just throw this out and see if anyone has any suggestions.
    I've got a swing app which is an administration tool to a rules engine I have built. I distribute the app to users using JNLP 1.2.
    Here's the problem. When I launch the app using JNLP, a portion of the app does not work. There is a panel in which I allow users to drag items off of a tree and onto a panel. They can drag and drop one item but when they attempt to drag and drop a second item it doesn't drop. If I take that same code which is being distributed via JNLP, copy it to the local machine and run it, it works. I can drag and drop all day long.
    There are no exceptions, no errors or funny gooey state things going on. I start the drag, the mouse pointer changes, I hover of the drop zone and let go of the mouse and it appears to drop, but the component does not show. Wacky.
    Does this set off any bells to anyone?
    Thanks,
    - Jay
    App compiled using 1.4.1_01.

    Ah ha.. Yes this does seem to the issue. Thanks for the response. I've tested it on a couple of machines and it works on the one's with 1.4.1 and it doesn't seem to work on 1.4.0 jre machines.
    NEW Question though, if I set my .jnlp to:
    <j2se version="1.4.1+"/>
    I get the 'ol 'Error Code 11 (11 Could not locate requested version'
    Is there any way to get this guy to auto-install???
    I've installed JRE 1.4.1 manually and it doesn't seem to pick that up either.
    Thanks...

  • Preview Drag and Drop Issue

    I use preview in school a lot. Converting lectures to PDF is a lot easier to use and i us a program called iFlash to make flash cards.
    What I want to do is use the text tool to highlight sections of text, drag them to the flash card window and then drop the text there. This is a really quick and easy way to make the flash cards.
    This works except when i click back to the card all the text that i dragged is deleted.
    Does anyone else have this issue. I have checked, this feature (highlight and drag...) works well in other programs (mail, pages) but not with my flash card program.
    Any ideas?

    I have checked, this feature (highlight and drag...) works well in other programs (mail, pages) but not with my flash card program.
    That suggests that the problem is with iFlash. Will it accept drags from other programs, besides Preview? If not, it probably doesn't support drag and drop at all. If it does, then its implementation is probably buggy, and you should contact the developer.

  • About Drag and drop issue

    As title, i am a newbie to flash using ActionScript 2.0 , and currently i enounter the problem with drag and drop coding. Below is my code:
    function dragSetup(clip, targ, position) {
    clip.onPress = function() {
    startDrag(this);
    clip.x +=2;
    clip.swapDepths(clip.x);
    clip.onRelease = clip.onReleaseOutside=function () {
    stopDrag();
    if (eval(this._droptarget) == targ) {
    this.onTarget=true;
    gotoAndStop(position);
    } else {
    this.onTarget=false;
    gotoAndStop(position);
    clip.myHomeX=clip._x;
    clip.myHomeY=clip._y;
    clip.onEnterFrame = function() {
    if(this.onTarget)
              this._x-=(this._x-this.myHomeX)/5;
              this._y-=(this._y-this.myHomeY)/5;
    function dragSetup2(clip, targ, correct) {
    clip.onPress = function() {
    startDrag(this);
    clip.x +=2;
    clip.swapDepths(clip.x);
    clip.onRelease = clip.onReleaseOutside=function () {
    stopDrag();
    if (eval(this._droptarget) == targ) {
    clip._visible = false;
    this.onTarget=false;
    gotoAndStop(correct+1);
    } else {
    this.onTarget=false;
    gotoAndStop(correct);
    var frame:Number = 1;
    dragSetup2(flexibleTxt, questionBox, frame);
    dragSetup(transparentTxt, questionBox, frame);
    dragSetup(blueTxt, questionBox, frame);
    dragSetup(TIRTxt, questionBox, frame);
    dragSetup(TRTxt, questionBox, frame);
    dragSetup(ssmTxt, questionBox, frame);
    dragSetup(siliconTxt, questionBox, frame);
    dragSetup(silicaTxt, questionBox, frame);
    dragSetup(silicateTxt, questionBox, frame);
    dragSetup(infraTxt, questionBox, frame);
    dragSetup(radioTxt, questionBox, frame);
    dragSetup(lightTxt, questionBox, frame);
    dragSetup(copperTxt, questionBox, frame);
    dragSetup(gopTxt, questionBox, frame);
    dragSetup(liquidTxt, questionBox, frame);
    The scenario is , whenever correct mc was drag and drop on the target mc , it move to the next frame with new target mc(new question) , for example "questionBox2".
    By applying the code above, everything work fine but i would like that whenever i "throw" the answer mc (flexibleTxt, blueTxt etc) , i want it to slide or glide for little more distance, jz like how u throw a card in real life on a smooth surface.
    I also prefer that when draging it's "angle?" change according to the direction of draging. For example if u point ur finger on north side of a card and drag to the east, it's "angle?" will change according to the direction u drag, in this case, means east.
    I know my description seem abit complicated but i really someone can undestand and help me solve this issue.
    This is the link i reference to for the code above,but i modify it to my own preference :http://www.swinburne.edu.au/design/tutorials/P-flash/T-How-to-drag-and-drop-in-Flash/ID-37 /
    PS : can i attach my fla file in this forum? if can, why i cant found any attach button?

    I am having a similar but reverse problem: Under 10.5.2, when trying to push or pull files from my wireless MacBook Pro via my Airport Extreme base station to or from my wired G5 Power PC, files hang in mid copy then stall.
    The other way around -- working from the G5 -- I have no problem at all.
    This started with 10.5, but I'm not sure if it was .1 or .2 because I upgraded from 10.4 just recently and did the combined 10.5 updates all at once on both machines.
    Thanks

  • Drag-and-drop issue with Linux, KDE

    My application used to work fine, but when i tested it on Linux drag and drop stopped working.
    I used snippet that would take list of supported DataFlavors of Transferable and used for loop to find a javafilelist one. (isJavaFileListType()).
    Well, now, it does that flava scan, but it doesn't find javafilelisttype in the list!
    I tried to retrieve String, serializedobject.. no use. It throws and illegal action exception of DnD or something like that.
    Does anybody know what's wrong, or had similar issues? I use j2 of v 1.5.2
    I shall provide you with more info if it's something totally new.

    I'd be interested in the answer to this too.
    It only just started happening to me a day or so ago, about the time that I think I did an OS upgrade.
    I'm on OSX 10.8.2.
    Its annoying.
    I can drop and drag in Finder but it just affects email.

Maybe you are looking for