Faking Drag&Drop operation to external application

Hello,
a rather complicated issue. in my program i have a JTable, and i can drag&drop from this jtable
to external programs like windows explorer by clicking the mouse and moving it from the table
to the external program.
how can i reproduce this exact behaviour WITHOUT user intervention?
in other words, how can i do this programmatically, creating a drop source at the start point,
then move the mouse, and release it above a specified location on the screen?
is this even possible in java (as we're running in a VM) ?

it has it's problems.
for example, if the drop point is above the source point, moving the mouse with the robot sometimes marks all entries in the table instead of performing a drag&drop operation. also, it seems that without a delay between the moves, strange things happen. so here is an updated version which workes 99% flawlessly for me.
package trakker;
import java.awt.Point;
import java.awt.Robot;
import java.awt.event.InputEvent;
import java.util.logging.Level;
* this thread fakes a drag & drop operation to the traktor decks
public class LoadDeckThread implements Runnable
     Point source;          // where was the mouse pointer before operation?
     Point track;          // where is the point of the track in the jlist?
     Point target;          // where do we move the track to?
     // constructor
     public LoadDeckThread(Point pTrack, Point pSource, Point pMoveTo)
          track = pTrack;
          source = pSource;
          target = pMoveTo;
     // thread run
     public void run()
          try
               // create a new robot
               Robot robot = new Robot();
               robot.setAutoDelay(100);
               // move the mouse to the track in the jlist
               robot.mouseMove(track.x, track.y);
               // click and hold
               robot.mousePress(InputEvent.BUTTON1_MASK);
               robot.waitForIdle();
               // move to the left to prevent list scrolling
               robot.mouseMove(50, target.y);
               // and to the topleft of our app
               Point p = Util.mainWnd.getLocation();
               robot.mouseMove(p.x, p.y);
               // move the mouse to the specified deck
               robot.mouseMove(target.x, target.y);
               // wait some time (otherwise it doesn't work?)
               //robot.delay(500);
               robot.waitForIdle();
               // release the mouse
               robot.mouseRelease(InputEvent.BUTTON1_MASK);
               robot.waitForIdle();
               // move back to the track
               robot.mouseMove(track.x, track.y);
               robot.waitForIdle();
               robot.mousePress(InputEvent.BUTTON1_MASK);
               robot.mouseRelease(InputEvent.BUTTON1_MASK);
               // now move back where we were
               robot.mouseMove(source.x, source.y);
               robot.waitForIdle();
               robot = null;
          catch(Exception ex)
               Util.log("Cannot invoke robot for drag&drop: " + ex.getMessage(), Level.SEVERE);
} instead of to close tags ;=)                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

Similar Messages

  • Help need in drag drop operation in AIR application

    I would like to know if there is a way to drag and drop an attachment file from an desktop mail client application(similar to MSoutlook)  into an AIR application and make it accessible to the AIR application.
    I did experiments with this the drag operation and its giving AIR a File Promise List format as its file type.
    But I'm not exactly sure how to make use of it once it is dropped. The examples in web explains how to manupilate File Promises list format from an AIR application to the desktop.
    There is not much explainations about droping a file promise list format into an AIR app. your valuable help will be greatly appreciated.

    Dear all,
    Is the above mentioned task feasible or not?.If not do mention any other way for implementing this functionality or close to it.
    Thanks

  • Native Drag&Drop in WEB-Flash-application

    For reaching of the functionality
    to adding photo in users portfolio
    I should use a "native drag&drop" method in my the web-flash-application.
    How to realise that in AS3, but not in AIR ?
    P.S. Matter of life and death
    P.P.S. so sorry for my english

    standalone app on the desktop will work with nativedragdrop (using NativeDragManager & publish app into AIR) - i`m know it.
    But my App live in a browser... And i want to use drag&drop any objects from other app to my app

  • Double-click/Drag-&-drop Photoshop files opens application but not file or I get a message saying that some files in Application Support are missing and I have to reinstall. (Photoshop CS/CS2/CS3)

    This is most commonly due to installing Photoshop CS/CS2 <i>before</i> doing an archive and install of Mac OS10.3 or OS10.4.<br /><br />One solution is to reinstall Photoshop 7/CS/CS3 after you have installed Mac OS10.3 or OS 10.4.<br /><br />If you have Photoshop 7 and 8(CS), the easiest way to reinstall Photoshop (without disturbing the original installation) is to install to your desktop. After the install is done just trash the Photoshop folder on the desktop.<br />Note: This will only work with Photoshop 7 and 8(CS) but not with 9 (CS2).<br /><br />Photoshop CS2 you must delete the Photoshop CS2 folder. If you have any 3rd party Plugins or presets remove them from the folder before deleting. Just placing the folder in the trash will not work it must be deleted. After reinstalling CS2 you can now put all 3rd party Plugins and presets back in the new folder.<br /><br />---------------------------<br />Another solution courtesy Anne Shelbourne<br /><br />Open your Previous System folder. <br />Find "Adobe Unit Types". <br />Copy it into: <Your current system Hard Drive>/Library/ScriptingAdditions/<br />Then reboot your Mac.<br /><br />---------------------------<br />However, if you happen to be running a non-English version, like Photoshop CS CE or Photoshop CS ME, it appears the missing file does not get installed. You would need to install and delete the international English version first.

    The problem you got into is a known problem after updating to Tiger. It is a small 4K file that gets trashed with the update. It is called the Adobe Unit Types. Both Photoshop and Photoshop Elements need this file to function.
    One way to get it back is to reinstall Photoshop, the other is to add this file again.
    You can get the file from here http://www.dd.se/Tips/bildbehandling/downloads/AdobeUnitTypes.zip
    It is only 3,7 KB big.
    You put the file you download here:
    [hard disk] /Library/ScriptingAdditions. If you don't have a Scripting Additions folder, you create it.
    As you trashed Photoshop, you need to completely deinstall it to be able to reinstall it.

  • Question about Drag & Drop operation!

    Who can give me an explaination about the methods in class DragSourceDragEvent
    getUserAction()
    getDropAction()
    getTargetActions()
    I 've read the api document , but it really conveied a unclear concept, Hope anybody can give me detaided explaination
    thanks a lot!

    Have a look Here
    Regards

  • Reinstalling CS2, and dragging/dropping files does not work

    I have Photoshop CS2. Or at least I
    had it. I had updated my operating system to Tiger, and it just caused a bunch of files to change, nothing really bad. It gave me an error message upon opening photoshop that "files necessary for running Photoshop were missing from the Application Support folder"
    So I read the advice on this FAQ:
    Scott Weichert, "Double-click/Drag-&-drop Photoshop files opens application but not file or I get a message saying that some files in Application Support are missing and I have to reinstall. (Photoshop CS/CS2/CS3)" #, 29 Dec 2003 2:45 pm
    And did what it said. I trashed the CS2 folder, and now when I try to re-install it my serial number won't work. Is my $400 serial number now permanently registered on a nonexistent platform?
    As an active photographer and graphic artist, I need Photoshop constantly. So any advice would be greatly appreciated as soon as possible. Thank you.

    The problem you got into is a known problem after updating to Tiger. It is a small 4K file that gets trashed with the update. It is called the Adobe Unit Types. Both Photoshop and Photoshop Elements need this file to function.
    One way to get it back is to reinstall Photoshop, the other is to add this file again.
    You can get the file from here http://www.dd.se/Tips/bildbehandling/downloads/AdobeUnitTypes.zip
    It is only 3,7 KB big.
    You put the file you download here:
    [hard disk] /Library/ScriptingAdditions. If you don't have a Scripting Additions folder, you create it.
    As you trashed Photoshop, you need to completely deinstall it to be able to reinstall it.

  • Drag/Drop inside SWFLoader not working

    I've got a Flex application that loads a secondary Flex app via SWFLoader. The secondary app uses drag/drop operations to rearrange components, delete them etc.  The secondary app works perfectly while it is running by itself (eg. not 'embedded' via SWFLoader into the main app).
    Once I load it into the main application using a SWFLoader drag/drop operations no longer work correctly. All other events seems to work fine. It is only drag/drop that don't always work right.
    Is there something I am missing that would cause this issue? I'm thinking there may be a property I need to set on the SWFLoader. Hopefully someone can help.

    Thanks Alex.
    I did as you say, and DragManager is in the report file in several places. Also, Drag/Drop does work inside of SWFLoader for the TileList in the loaded app, and even somtimes as it should as far as the drag/drop operation I am talking about, but not always.
    It seems to work sometimes and not others. When it does work it is not nearly as smooth as when I run the app as a "stand alone" and I never see the drag proxy while dragging inside of SWFLoader.
    Is there anything else that could be causing these issues? 

  • Drag/Drop Proxy Image

    I would like to be able to access the Proxy Image during a
    drag/drop operation inside the DragOver event. Is it possible to
    get refernce to that object to be able to change the image, get
    it's current location, etc?

    1. Using canvas in flash is uncommon, even in Flex its a class that has been replaced by more flexible solutions since flex 4: http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/mx/containers/Canvas.ht ml
    2.Shouldn`t your localToGlobal method not starting from canvas ? Instead of image? Not sure how you setup your whole application)
    http://www.orlandmedia.com/blog/tutorials/how-to-use-localtoglobal-in-actionscript-3-0/

  • Tree drag-drop function

    hello all,
    there is one single tree component in my application.
    XML is dataprovider of that tree.
    e.g
    <node name="Cars" id="1" isparent="true">
    <node name="Audi" id="2" isparent="true">
    <node name="A4" id="3" isparent="false"/>
    <node name="A6" id="4" isparent="false"/>
    </node>
    <node name="Mercedes" id="5" isparent="true">
    <node name="M-Class" id="6" isparent="false"/>
    <node name="R-Class" id="7" isparent="false"/>
    </node>
    </node
    when i drag one node and drop to another node, how can i know the xml value of
    both source & destination node?
    e.g
    we are Dragging 'R-Class' node to 'Audi' node, on dragComplete OR dragDrop
    event, how to get R-Class node id 7 & Audi node id 2 in different variables.
    So we can check some validation of node and perform drag-drop operation.
    Any idea?
    Steve Roger.

    actually what i want to implement is like :
    When drapDrop event complete, i want XML value of both nodes (source & target) in variables.
    Then I will show dialog box having some options & instructions (e.g You wanna Move node OR Copy node to target).
    Depend on user selection, do the operation.
    hope u get application scenario.
    is this possible for tree control using drag drop? if so, then how?
    Please help.
    Thank you,
    Steve Roger.

  • Drag-Drop not working with JRE 1.6.07

    I have a problem where (when using the next-gen java plugin) applets do not appear as drop targets.
    In more detail, I have a .NET winforms application, which has a web browser component on it running an Oracle forms application in a Java app. In JRE 1.6u7 you can drag an item onto the applet and it will notify .NET that a drag-drop operation has occurred. In newer versions of JRE (i've tested 6u11 and 6u13) with the "enable next-generation java plugin" checked, this drag-drop no longer works. (instead of a "hand" cursor, you get a "not allowed" cursor).
    Has anyone else experienced this issue?
    Thanks,
    Rich.

    Up
    No idea ?

  • Effect on Sprite breaks drag&drop mechanics

    Hello,
    I've a problem with applying effects to a number of SpriteVisualElements.
    I had set up a grid of said sprites and could drag and drop them around using the startDrag() and stopDrag() methods.
    I then decided to use effects to somehow animate these sprites when I click or drag them, and chose to play the effects in the handler of the MouseEvent.MOUSE_UP event.
    Things still work, but.... some effects break the drag&drop operation.
    The first time I drag or click the sprites everything works fine, but when I try to drag them again after the effect has been played once they won't drop. I can see the sprites move along with the mouse cursor as i drag them, but when I release the mouse button the sprites jump back to their starting position instead of dropping where I've just dragged them.
    This happens only on individual sprites once the effect has been played on them a first time. After that the effect still plays each time (meaning that the MOUSE_UP event is dispatched), but they won't drop.
    I'm also tracking the coordinates of the sprites as they are dragged, using a label I update through the MOUSE_MOVE event. The sprites' coordinates update normally the first time I drag&drop them, but then, after the effect is played for the first time, the coordinates won't update either.
    This only happens with effects that affect the sprites' appearance: s:Animate (scaleX, scaleY), s:Rotate, s:Scale.
    The only one that seems to work without causing any problem is s:Move. Don't understand why.
    Does anyone have any idea?
    Thanks a lot

    Oh, I see. Thanks.
    So... i should use the "normal" flex drag&drop.
    There is just a problem, the documentation says:
    The following Flex features are not supported in mobile applications:
    No support for drag-and-drop operations
    http://help.adobe.com/en_US/flex/mobileapps/WSf3db6597adcd110e19124fcb12ab3a1c319-8000.htm l#WSca1097f1363f276f-8bfd51512ba1a8112c-8000
    I had to work my way around this limitation one time in the past. I assumed that those lines referred to list-based controls only and I figured that maybe I could manually implement drag&drop with my custom components, which I did. It worked quite well, but unfortunately it also made the mouse cursor appear beneath my fingertip. It was very annoying and I couldn't find a way to get rid of it.
    I also thought about implementing the "flex" drag&drop using TouchEvents instead of MouseEvents (maybe that was the cause of the problem, I thought), but the DragManager.doDrag() method requires a MouseEvent as argument.... and that's when I decided to switch to the more basic .startTouchDrag() and stopTouchDrag() methods.
    Now, is there something else I could try?
    How do other people (more experienced than me) implement their drag&drop mechanics, for starters?
    Thank you :-)

  • Drag/Drop Question

    I have implemented drag & drop using a datagrid and a list control. The items that need to be dragged are a simple value object that conatin data. Everything works as far as the drag/drop operations, however, I need to be able to know which item has been dropped. It's probably simple, but I can't find it. Can anyone help?

    Just give each item an id
    and listen to the
    <s:List id="destList"
         dragDrop="destList_dragDropHandler(event)"

  • Drag Drop based Report Builder

    Hello to all
    I want to create a report builder that will create report with drag drop operation. Can any one give me an idea or example that will help me a lot.
    With Regards
    Preet
    Edited by: socmag_Java_developer on Apr 17, 2009 3:27 AM

    Hi
    I've just resolved a similar problem in Visual Studio whereby I had created a matrix with several columns and wanted to show each column as an overall percentage of each row.
    It wasn't in sharepoint, but it may give you an idea of where to look to help you resolve this issue?
    Basically, you have to tell the formula which set of data you want to add together to use as the number to do the divison by:
    For example:
              |Column1| Column 2 | Column 3 |
    Row 1  |     10    |     10       |     10       |
    Row 2  |     10    |      10      |     20       |
    If we assume we want to add the numbers in row 1 and show them as a percentage, we would expect to see 33% across all columns.  In row 2, we would expect to see 25%, 25% and 50%.  The formula to do this is:
    Sum(Field)/Sum(Field,"RowGroupName")
    It works in Visual Studio in a report matrix - hope it helps point you in the right direction for Sharepoint?
    Regards
    Kaz

  • Drag Drop Cancel

    Is there a way to cleanly cancel a drag/drop operation. I
    want to cancel it by hitting the escape key. I can capture the
    Escape key being hit during the drag/drop I don't know how to make
    the Image proxy go away and return to it's source.
    Thanks in adance!

    You might be able to spawn a new DragEvent to fool it into
    thinking you've released the object. Dispatch it from the component
    that you are dragging (or the grid/list that spawned the item):
    var de:DragEvent = new DragEvent(DragEvent.COMPLETE);
    de.action = DragMananger.NONE
    draggableObj.dispatchEvent(de);
    Play around with that.

  • Drag & Drop in Picture Control

    Hi,
    How can we implement dragdrop control in picture control?

    Hi Sree ram,
    Four events are triggered in conjuction with drag&drop operations for picture control.
    ONDRAG,ONDROP,ONDROPCOMPLETE,ONGETFLAVOUR.
    Register the events using set handler method and handle them in thier respective methods.
    Chk this link for further detail:
    http://help.sap.com/saphelp_erp2005vp/helpdata/en/ae/6eaae05ac711d396b300a0c9308b1f/frameset.htm
    http://help.sap.com/saphelp_erp2005vp/helpdata/en/c0/147a36c70d2354e10000009b38f839/frameset.htm
    regards,
    balaji reddy g
    ***reward if answers are helpful

Maybe you are looking for