Drag and Drop box?

Hi all
I want to code a Java application, that when executed, will display a box in a window. I then want to be able to drag a file from windows explorer into this box, and after dropping it in the box, I want the file name to be displayed in the console window. I'm really just interested in doing the drag and drop feature.
Can anyone give me some links or some info that would help me do this?
Thanks very much for any help!

Did you try the Drag and Drop tutorial, http://java.sun.com/docs/books/tutorial/uiswing/dnd/intro.html? The section titled "Importing a New Flavor: Files" may be what you're looking for.

Similar Messages

  • Why is drag and drop not working in lion

    Drag and drop has not worked correctly once since I started using lion.

    Hi
    I had the same problem in my case the remedy was simple
    Preferences - Universal Access - Mouse and Trackpad tab - trackpad options
    tick the drag and drop box
    I dont know why this option had been turned off but ticking this box restored the drag and drop function
    HTH

  • Problem using text boxes as the "image" to drag and drop over audio file

    I have been adding audio files to my page in iWeb (previous version, not '08), but I am having a problem giving them titles.
    When you first drag a file from iTunes into iWeb, it provides a space for you to drag and drop a picture. The online iWeb guide also says that you can drag a text box there instead of a picture.
    I created a text box with the text I would like to drop over the controller. However, it is no longer allowing me to drop the text box there. I used to be able to do this, and I don't know what I'm doing differently now. Any suggestions?
    Thanks!
    -- Will

    foobar2000 with the ipod plugin will allow you to drag/drop FLAC files and when it syncs the ipod, it converts the FLAC files on the fly. MUCH better than dealing with the crappy iTunes interface and having to pre-convert the files. I absolutely loathe iTunes and it just gets worse and worse!

  • Drag and drop files from Outlook move mails to delete box

    Hi everybody,
    I'm trying to develop a feature to be able to drag one or several mails from Outlook to my Java application.
    As Java doesn't recognize a drop of an Outlook mail, in my program, I assume that if it's not a known file type, it is a mail. (I know it's quite straightforward).
    When one or several mails are dropped I use a function from a plugin to get detail from the Outlook mails to import them into my application. In fact it import the data from the current selected mails in Outlook. This function is working perfectly when I use it without drag and drop (from a button 'Import' in the application).
    My problem is that when I use drag and drop, mails are imported correctly but sometimes (not always) they are also moved in the delete box of Outlook. I have done several tests to try to figure out what is the cause. I have used several versions of Outlook, I have dropped 1 mail and several mails a the same time, etc...
    Here are my tests results: it deletes the mails randomly but it seems to delete more often when my Java application isn't in full screen.
    What could be the cause?
    Another question: is it possible to configure my drop area to do copies only and not move? When you drag and drop you have a small symbol next to your mouse arrow. It is a '+' inside a square for copy and an empty square for move. My drag and drop does move by default. I could maybe avoid my deletion problem by changing it to copy?!
    Cheers.
    Edited by: Foobrother on Apr 16, 2009 2:46 AM

    I think I have fixed it. I still have to make more tests, but it doesn't delete the mails any more for the moment.
    In fact, when dropped item is detected as a file I do dtde.acceptDrop(DnDConstants.ACTION_COPY);But if it's not, I just set a variable to say that it is an Outlook mail.
    So I have added the line dtde.rejectDrop(); to cancel the drop. And now it seems to work.
    Apparently, I didn't clean some stuff when doing an email drop and it still wanted to move the mail or something?!
    Anyway, thanks for the help

  • Drag and drop in a vertical box

    Hi
    I was wondering if there's any sample out there that i can check where the user drags and drops the compoents in a verticle box layout and during the DnD operation the dragged component pushes all the other compones up or down depending on the direction in a smooth animated manner, including when the component is being resized.
    I do know the Flex ObjectHandles by Marc Hughes component that's what im using right now but then again it does not cover this other requirement that i need.
    Thanks.

    for those interested (if there is), i've given up on leadselectionpath, and i draw my outline manually, by overloading paintComponent and using the getPathBounds method.
    still, i don't know what leadselectionpath means... well, i guess i don't need to know, but if anyone want to share his knowledge...
    nicolas

  • Drag and Drop between two list boxes

    Hi all
    I am working over Drag and Drop .. i have to implement Drag and Drop between two list boxes .. both list box exist in same page ..each list box have number of rows.. please give me some idea ... as i am new for JSP and Servlet...
    Thanks in advance
    Regards
    Vaibhav

    Hi all
    I am working over Drag and Drop .. i have to
    implement Drag and Drop between two list boxes ..
    both list box exist in same page ..each list box have
    number of rows.. please give me some idea ... as i am
    new for JSP and Servlet...
    Something close to what you are looking for is Select Mover in Coldtags suite:
    http://www.servletsuite.com/jsp.htm

  • Adobe Presenter 10 Drag and Drop questions - only grey box when trying to create

    Hi,
    I try to create drag and drop questions in Presenter 10 and after clicking on Add Question -> Drag Drop, the new window opens but where I should be able to define the questions etc, the screen is just grey. Have the same issue on three other systems as well.
    Flash is updated to latest version and so is Presenter 10.
    Weirdly the installed Flash version is 15, but a right-click into the grey box shows me version 11.
    Any ideas?
    Thanks,
    Chris

    Just in case someone else has the same problem, a chat with Adobe brought the solution:
    On the gray screen, Right click and go to Global settings
    Go to advanced tab
    Scroll down and click "Trusted location settings"
    On the "Trusted location settings" window, click "add" on the bottom
    Click "Add Folder" and select "Local disk c"
    Click "Ok" and Confirm on "Trusted location settings" window
    Worked for me (on three different machines) like a charm!

  • How to add imge to another image box by drag and drop

    Hi all
       i am using flex 3.and my problem is to drag an image and drop to another box or image what ever.just need to display the copy of the source image in its drop target.is it possible drag an image?if it is then how?please help me.
    thanks and regards

    there are examples of image dragging and dropping here:
    http://www.adobe.com/devnet/flex/quickstart/adding_drag_and_drop/
    i imagine for your problem, you want the final example, and instead of passing across an integer value, you want to pass across the image source.

  • Drop down box drag and drop storyboard

    Hello
    I'm trying to create an interactive storyboard using the drag
    and drop function to drag characters onto a stage so the user can
    arrange them however they wish. My problem is that now I have
    started this project I have realised I need a lot more images than
    first thought and have limited space as this is to go on a website
    and have the option to be printed.
    Therefore, I have been trying to create a dropdown menu with
    tabs with the character name on and when the tab is clicked a box
    with all that characters images appears below. Now I managed to
    make this work but then when you click between the tabs having
    placed the characters on the storyboard, if you click a tab in the
    timeline before the one you were on, obviously the character
    disappears from the stage. Is there anyway of creating a drop-down
    menu or something similar to save space, which can have draggable
    movieclips in?
    Also my second problem is does anyone know how to create a
    duplicateable movieclip. For example, once a character is dragged
    from the menu onto the storyboard, it is now only on the storyboard
    and there is only one copy. Now I know I could just make loads of
    the same character and layer them, but it would be much better if
    someone knew of a way to duplicate a movieclip once it is dragged
    away so that there is always one in the menu.
    Any help would be greatly appreciated as I am fairly new to
    flash and am trying my hardest to get to grips with actionscript.
    Cheers,
    Anna

    Thanks for your help but not too sure I understand most of
    it.
    Just working on duplicating characters at the moment and so
    far have managed to duplicate once but then can only move duplicate
    character and original disappears.
    This is the code I have on the movieclip at the mo - any
    suggestions very very welcome.
    on (press) {
    startDrag(this, true);
    duplicateMovieClip(this, newname="drag_clip_new", 2);
    on (release) {
    stopDrag();
    Don't know much about depth etc.
    Also found this code on the net but am having trouble
    changing it to fit my needs:
    var mcNum = 1;
    var dupli:MovieClip;
    mc1.onPress = function() {
    dupli = mc1.duplicateMovieClip("mcname"+mcNum, ++mcNum);
    dupli._x = mc1._x;
    dupli._y = mc1._y;
    dupli.startDrag();
    this._parent["mcname"+mcNum].onPress = function() {
    this.startDrag();
    this._parent["mcname"+mcNum].onRelease = function() {
    this.stopDrag();
    mc1.onRelease = function() {
    dupli.stopDrag();
    mc1.onReleaseOutside = function() {
    dupli.stopDrag();
    Again any help very welcome!

  • Open dialogue box in Lion is not supporting drag and drop files (UPDATE)

    This is freaking me out. Because now in Lion you can't drag and drop file from the desktop (and other folders!) to open dialogue box. It was most usefull function in Mac OS X. Why Apple kill usabillity?
    Access to the desktop is not a problem (command + d), but if the current file is located deep in the hierarchy of folders, it becomes a big problem!!!
    Dear Apple, please fix it as soon as you can.
    UPDATE: Omg, I found the problem, it works only if I drad and drop file on the bottom panel, not in all open dialogue box area:

    Interesting, this is the second time today I've seen this one come up. It does work, drag and drop works like crazy everywhere here. What does console say when it happens (or not, in your case)?

  • Is it possible to drag and drop an arrangement from another software program such as band-In -Box to garage band

    is it possible to drag and drop an arrangement from another music program like Band-ina-box into garage band

    GarageBand for iPad is a pretty closed system.
    The Song File
    You can only open GarageBand for iPad Song Files with the extension .band. Please note that those files look the same as the ones form GarageBand 11. However, they are only upwards compatible but not downward compatible. GarageBand iOS -> GarageBand OSX -> Logic.
    Audio Files
    You can import a wide variety of Audio Files into GarageBand (via iTunes File Sharing) to use in your Song. But any material from another app has to be mixed down first. Either as a single stereo mix or you mix each track separately and then import those separate files ("stems") into GarageBand. This is a typical procedure to move material to a different app,for example for mixing.
    Hope that helps
    Edgar Rothermich
    http://DingDingMusic.com
    'I may receive some form of compensation, financial or otherwise, from my recommendation or link.'

  • IMovie is not letting me drag and drop transitions, music, text boxes. Worked fine all along and now nothing. What happened?

    iMovie has always let me "drag and drop" transitions, music, text boxes etc into my Project. This morning it is not allowing me to "drag and drop" anything. This is for a client and I am so frustrated. What happened to make it stop letting me "drag and drop"?

    I have only dragged Titles to the project. When I did, it worked best not to drag and release onto the video strip (like with the old version) but just above the strip. When you drag and hover above the strip you get a little pointer to the starting point on the strip. Hope this helps.

  • Problem with Drag and drop in panel dashboard

    Hi
    I am having problem with drag and drop in panel dashboard.
    I will explain what i am doing.
    I am using Oracle three column template in First region i am having a table that showing all customer.
    I drag one record from my table and drop it on customer info (CIF) page on second region it is working fine.
    my CIF page has a dashboard with 6 panel box. i am showing 6 different jsff in 6 panel box.
    I put drop target in each jsff
    <af:dropTarget dropListener="#{backingBeanScope.backing_customerinformation.handleItemDrop}"
    actions="COPY">
    <af:dataFlavor flavorClass="org.apache.myfaces.trinidad.model.RowKeySet"
    discriminant="CustomerSearchDnD"/>
    </af:dropTarget>
    when i put drop target my panel boxes moves only when i drag it to another panel box header not entire part of panel box.
    if i remove the drop target then panel box move normally as the example given on: [http://adfui.us.oracle.com:7778/faces-trunk/faces/visualDesigns/dashboard.jspx?_afrLoop=2021391022520156&_afrWindowMode=0&_afrWindowId=null] but in taht case i am not able to drag and drop my data

    You must be an Oracle employee as you're referring to a component in the upcoming JDeveloper version which has yet been released to the general public. Oracle employee's are, I believe, directed to post on internal Oracle forums.
    CM.

  • I can't drag and drop songs onto my iPod from iTunes. (Manual transfer is not working.)  Please help!

    Normally, I just select songs and I'm able to drag and drop them from my library onto my device.  I have an iPod Touch and an iPhone 4.  I want to drag and drop my songs from the library onto my iPod Touch.  I have already selected manual upload instead of automatic sync.  I tried suggestions from the Mac message board (since other people seem to have had a similar issue), and their solutions didn't work for me.  I have restarted both iTunes, my computer, and reconnected my iPod multiple times.  I don't know what's going on, and I can't find a fix anywhere in iTunes help.  If anyone knows what to do, or has any suggestions, please let me know!  Thanks.

    Update: I seem to have fixed the problem!  I went to the "summary" section of my iPod after clicking on the device on the left side of iTunes.  I checked the box that allowed me to "manually manage music and videos" and applied this option.  The songs are syncing!  And, yay, they're playing on my iPod now!  Hopefully, this helps anyone else who might have this problem.  There might be other issues, but this is working for now.

  • Drag and Drop of cell content between 2 tables

    Hi Guys,
    Iam into implementing drag and drop of cell contents between 2 different tables,say Table1 and Table2.(Iam not dragging and dropping rows or cells,Just copying the content of one cell to another).
    Have extended the java tutorial class "TableTransferHandler" and "StringTransferHandler" under http://java.sun.com/docs/books/tutorial/uiswing/examples/dnd/index.html#ExtendedDndDemo to satisfy my needs.
    The drag is enabled for Table1 and table2 as follows.
    jTable1.setDragEnabled(true);
    jTable1.setTransferHandler(new TableTransferHandler());
    jTable2.setDragEnabled(true);
    jTable2.setTransferHandler(new TableTransferHandler());
    Dont be taken aback with the code I have put.It just to show what I have done..
    My questions are put at the end of the post..
    //String Transfer Handler class.
    public abstract class StringTransferHandler extends TransferHandler {
        protected abstract String exportString(JComponent c);
        protected abstract void importString(JComponent c, String str);
        protected abstract void cleanup(JComponent c, boolean remove);
        protected Transferable createTransferable(JComponent c) {
            return new StringSelection(exportString(c));
        public int getSourceActions(JComponent c) {
            return COPY_OR_MOVE;
        public boolean importData(JComponent c, Transferable t) {
            if (canImport(c, t.getTransferDataFlavors())) {
                try {
                    String str = (String)t.getTransferData(DataFlavor.stringFlavor);
                    importString(c, str);
                    return true;
                } catch (UnsupportedFlavorException ufe) {
                } catch (IOException ioe) {
            return false;
        protected void exportDone(JComponent c, Transferable data, int action) {
            cleanup(c, action == MOVE);
        public boolean canImport(JComponent c, DataFlavor[] flavors) {
              JTable table = (JTable)c;         
             int selColIndex = table.getSelectedColumn();
            for (int i = 0; i < flavors.length; i++) {
                if ((DataFlavor.stringFlavor.equals(flavors))&& (selColIndex !=0)) {
    return true;
    return false;
    }//TableTransferHandler classpublic class TableTransferHandler extends StringTransferHandler {
    private int[] rows = null;
    private int addIndex = -1; //Location where items were added
    private int addCount = 0; //Number of items added.
    protected String exportString(JComponent c) {
    JTable table = (JTable)c;
    rows = table.getSelectedRows();
    StringBuffer buff = new StringBuffer();
    int selRowIndex = table.getSelectedRow();
    int selColIndex = table.getSelectedColumn();
    String val = table.getValueAt(selRowIndex,selColIndex).toString();
    buff.append(val);
    return buff.toString();
    protected void importString(JComponent c, String str) {
    JTable target = (JTable)c;
    DefaultTableModel model = (DefaultTableModel)target.getModel();
    //int index = target.getSelectedRow();
    int row = target.getSelectedRow();
    int column = target.getSelectedColumn();
    target.setValueAt(str, row, column);
    protected void cleanup(JComponent c, boolean remove) {
    }Now I want to put in the following functionality into my program...
    [1]prevent dragging and dropping text in to the same table.That means I dont want to drag a cell content from Table1  and drop to another cell in Table1. Want to drag and drop cell content only from Table1 to Table2.
    [2]Change cursor on a un-defined Target. That means how to prevent a drag from a particular column in Table1.Also how to prevent a drop to a particular column in Table2. How to change the cursor to a "NO-DRAG" cursoror "NO-DROP" cursor.
    Could it be done using Drag Source Listener and drop Target Listener?.
    If yes,How can these listeners attached to the table and how to do it?
    If No,How Could it be done?
    [3]Want to change the background colour of the cell being dragged and also the background colour of the target cell where the drop is made...
    [4]Is there any out of the box way to make an undo in the target cell(where drop was made) so that the old cell value is brought back.
    How can I extend my code to take care of the above said things.
    Any help or suggestions is greatly appreciated.....
    Edited by: Kohinoor on Jan 17, 2008 10:58 AM                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

    Hi Guys,
    Iam into implementing drag and drop of cell contents between 2 different tables,say Table1 and Table2.(Iam not dragging and dropping rows or cells,Just copying the content of one cell to another).
    Have extended the java tutorial class "TableTransferHandler" and "StringTransferHandler" under http://java.sun.com/docs/books/tutorial/uiswing/examples/dnd/index.html#ExtendedDndDemo to satisfy my needs.
    The drag is enabled for Table1 and table2 as follows.
    jTable1.setDragEnabled(true);
    jTable1.setTransferHandler(new TableTransferHandler());
    jTable2.setDragEnabled(true);
    jTable2.setTransferHandler(new TableTransferHandler());
    Dont be taken aback with the code I have put.It just to show what I have done..
    My questions are put at the end of the post..
    //String Transfer Handler class.
    public abstract class StringTransferHandler extends TransferHandler {
        protected abstract String exportString(JComponent c);
        protected abstract void importString(JComponent c, String str);
        protected abstract void cleanup(JComponent c, boolean remove);
        protected Transferable createTransferable(JComponent c) {
            return new StringSelection(exportString(c));
        public int getSourceActions(JComponent c) {
            return COPY_OR_MOVE;
        public boolean importData(JComponent c, Transferable t) {
            if (canImport(c, t.getTransferDataFlavors())) {
                try {
                    String str = (String)t.getTransferData(DataFlavor.stringFlavor);
                    importString(c, str);
                    return true;
                } catch (UnsupportedFlavorException ufe) {
                } catch (IOException ioe) {
            return false;
        protected void exportDone(JComponent c, Transferable data, int action) {
            cleanup(c, action == MOVE);
        public boolean canImport(JComponent c, DataFlavor[] flavors) {
              JTable table = (JTable)c;         
             int selColIndex = table.getSelectedColumn();
            for (int i = 0; i < flavors.length; i++) {
                if ((DataFlavor.stringFlavor.equals(flavors))&& (selColIndex !=0)) {
    return true;
    return false;
    }//TableTransferHandler classpublic class TableTransferHandler extends StringTransferHandler {
    private int[] rows = null;
    private int addIndex = -1; //Location where items were added
    private int addCount = 0; //Number of items added.
    protected String exportString(JComponent c) {
    JTable table = (JTable)c;
    rows = table.getSelectedRows();
    StringBuffer buff = new StringBuffer();
    int selRowIndex = table.getSelectedRow();
    int selColIndex = table.getSelectedColumn();
    String val = table.getValueAt(selRowIndex,selColIndex).toString();
    buff.append(val);
    return buff.toString();
    protected void importString(JComponent c, String str) {
    JTable target = (JTable)c;
    DefaultTableModel model = (DefaultTableModel)target.getModel();
    //int index = target.getSelectedRow();
    int row = target.getSelectedRow();
    int column = target.getSelectedColumn();
    target.setValueAt(str, row, column);
    protected void cleanup(JComponent c, boolean remove) {
    }Now I want to put in the following functionality into my program...
    [1]prevent dragging and dropping text in to the same table.That means I dont want to drag a cell content from Table1  and drop to another cell in Table1. Want to drag and drop cell content only from Table1 to Table2.
    [2]Change cursor on a un-defined Target. That means how to prevent a drag from a particular column in Table1.Also how to prevent a drop to a particular column in Table2. How to change the cursor to a "NO-DRAG" cursoror "NO-DROP" cursor.
    Could it be done using Drag Source Listener and drop Target Listener?.
    If yes,How can these listeners attached to the table and how to do it?
    If No,How Could it be done?
    [3]Want to change the background colour of the cell being dragged and also the background colour of the target cell where the drop is made...
    [4]Is there any out of the box way to make an undo in the target cell(where drop was made) so that the old cell value is brought back.
    How can I extend my code to take care of the above said things.
    Any help or suggestions is greatly appreciated.....
    Edited by: Kohinoor on Jan 17, 2008 10:58 AM                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

Maybe you are looking for

  • OBIEE 11g - zoom to datarange option

    I have problem and I wonder is it bug or is it missing functionality in OBI 11g. In OBI 10 g we have possibility to set range of axis dynamically on line charts (and other). It is achived by "Axis scaling" window and checkbox "Zoom to datarange". It

  • Phone Stuck In Recovery Mode

    Like the idiot I am, I decided to upgrade the software of my iPhone to the 4.0 version. I first had to download the most recent version of iTunes...no problem there. When I tried to download the new iPhone software everything froze up. It went throug

  • How to Add IBAN Field in the Bank Details Infotype?

    Hello All, I need to know the procedure for How to add IBAN field in the bank details infotype? Could anyone help me please. I m new to SAP HR. Immediate help will be appreciated. Thanks. Regards, Mudassir.Imtiaz

  • I have Iphone 5 with 7 installed. Facetime will not connect. How do I fix this?

    I start face time either by selecting the contact then Facetime or go to Facetime then selecting the contact. It starts to ring the far party answers the phone says connecting then it times out and says that the contact not available. It does this ev

  • How do I change a document so that I can fill it out online, someone please help asap

    Someone PLEASE help me.  With my job, I have to complete online Marketing Analysis.  How can I change the document so that I can fill it out online and email it back?