Comment 0 for bug 1262394

Revision history for this message
Fabrizio Borgia (fabrizio-borgia) wrote : Java dragDrop not working

Sikuli version: 1.0.1 (released 2013-08-12)
Operative System: Mac OS X 10.7.5 (64bit)

Hi, i have developed an automatic farming tool for a game named "Battle Nations". I have been using the Sikuli IDE, but recently, i have switched to Java, because I am a Java developer, and I wanted to add more complexity to my project.

The problem is that the dragDrop function is not working, ONLY for the BattleNations window.
I tried two different approaches to achieve the drag n' drop:

1) Using dragDrop (the click is used to ensure the focus on the window).

        Screen theScreen = new Screen();
        theScreen.wait(3.5);
        theScreen.click(theScreen.getCenter());
        theScreen.dragDrop(theScreen.getCenter(), theScreen.getCenter().offset(0, -100));

2) Using mouse events

        theScreen.wait(3.5);
        theScreen.click(theScreen.getCenter());
        theScreen.mouseDown(Button.LEFT);
        theScreen.wait(0.5);
        theScreen.hover(theScreen.getCenter().offset(0, -100));
        theScreen.wait(0.5);
        theScreen.mouseUp(Button.LEFT);

Both approaches work on any window (browsers, NetBeans itself, a folder with many files) without any problem. But when it comes to my BattleNations window, the drag is not performed: the mose moves correctly from a location to the other. But nothing changes in the user interface (as if the mouse is not pressed anymore).

The funny thing is that the dragDrop works perfectly using the Sikuli IDE, even with BattleNations!
Can someone help?