Customised Flavor Drag and Drop in Indesign CS3

Hello All,
I'm implementing a to Drag & Drop from an external application (say windows Desktop) on to Indesign CS3 Document. I have implemented a Custom Flavor helper and a Data Exchange helper for my custom Flavor.
I have registered my Custom Flavor in Constructor of My Custom Flavor
RegisterExternalFlavor(TEXT("Portable Document Format"));
In the Function CouldAcceptTypes, it is
if (dataIter != nil)
// Test for swatches in the drag
DataExchangeResponse response;
response = dataIter->FlavorExistsWithPriorityInAllObjects(kPDFExternalFlavor);
bool16 valid = response.CanDo();
if (valid)
return DragDrop::TargetResponse(response, DragDrop::kDropWillCopy);
return DragDrop::kWontAcceptTargetResponse;
Now My Problem it is this variable "valid" is always False. So it is not going inside the loop. and hence I am not getting call in ProcessDragDropCommand. The Only calls which I am getting is in
DataExchangeHandler::CreateScrapStorage() & DataExchangeHandler::GetFlavor()
Note that I am dropping PDF only. I suppose the problem is in dropped Flavor only that it is not accepting.
Kindly help.
I am stuck at this point.
..Many Thanks

From the Swing tutorial check out this section on [url http://java.sun.com/docs/books/tutorial/uiswing/misc/dnd.html#customComp]Data Transfer With a Custom Component.
The [url http://java.sun.com/docs/books/tutorial/uiswing/misc/example-1dot4/index.html#DragPictureDemo]Drag Picture Demo has the code I think you are looking for. Specifically the PictureTransferHandler.java class.
a) In the createTransferable() method the source component is saved
b) In the importData() method the source and target component are compared. When they are the same you exit immediately and set a "shouldRemove" boolean.
c) In the exportDone() method your check the action and the shouldRemove boolean before doing anything.

Similar Messages

  • Why won't drag and drop work with Library Assets in Illustrator or InDesign?

    I've read a couple of threads with people having this issue, some dating back to late summer last year. I tried the fixes offered up in the responses, but haven't had success yet.
    All my programs are up-to-date, but I cannot drag and drop graphics from my library into InDesign or Illustrator. Photoshop is working fine.
    Are there any actual solutions to this yet?

    What kind of graphic are you talking about? In the Library panel (Illustrator) or CC Library panel (InDesign) graphics are identified with a small label to tell what their source is (Ai, ID, PS, SVG, etc.)
    And even though you say you have the latest version, exactly what version of InDesign do you have? You can see it in the About InDesign choice under the InDesign menu (Mac) or Help menu (Windows).

  • Can't drag and drop files into Indesign.

    My ability to dragon and drop files into InDesign has stopped. I also cannot copy and paste. I have tried dropping previously used jpg's and PDFs as well as copying text from Acrobat, Chrome and Word. I reset the prefrences with control option command shift, but still no luck - I can't drag and drop files. Also, I cannot move files with my mouse in the program.

    Nobody can help you without system information. Could be anything from graphics driver issues to a defective mouse to a busted operating system...
    Mylenium

  • Mackbook can't drag and drop after working in indesign CC for a while.

    This has been going on for a while.  I am working in Indesign then all of the sudden all my drag and drop cappabilities are gone.  i have to restart my computer to fix the problem and being that the start up times for the cc software is outragous,  this sucks for my workflow.  I have seen Adobe techs say that there isn't a difference in the backend between 6 and cc for the whole suite but seeing is believing and I don't make things up.

    hi Dustin, maybe with a bit more info someone will be able to help with this:
    what Mac OS System version are you using?
    what is it you are 'dragging and dropping'? : Is this drag and drop of text in InDesign? Or are you dragging and dropping from the Mac OS (e.g. a file from a folder) into InDesign?
    If you are referring to drag and drop from OS into InDesign: I'm thinking this 'might' be a Mac OSX issue. If you look over at https://discussions.apple.com/index.jspa there seem to be plenty of issues with drag and drop across different OS versions.
    Next time it stops working whilst you are in InDesign, does it still work in other programs? That is one way of determining if this is caused by InDesign or the operating system. If it is the OS, my guess is that it stops working in other applicaitons as well.
    Hope this helps,
    Cari
    twitter: carijansen
    facebook: carijansen.au

  • Drag and drop won't work since installing InDesign CC 2014

    That's it really. Any ideas?
    I'm on an iMac with 10.9.4. Since installing InDesign from Creative Cloud Drag and drop, and I think cut and paste doesn't work.

    google those issues.

  • Designing a Drag-and-Drop Template using InDesign

    Hi,
    Please forgive my naivity here - I have just been handed a project for which I am completely unqualified, and am hoping for your help!
    I need to design an advertising booklet (folded A4 - i.e. each page being A5) to go out each month. Our customers will submit their adverts to us in various formats (single slot, double slot, half page, full page, etc, etc).
    My aim is to create a template for this so that, each month, I just need to drag and drop the adverts as they arrive, into set fields on the page, so that I don't have to worry about page layout, bleeding, etc.
    My boss has handed me a copy of InDesign CS5, and instructed me to see what I can do...
    So, firstly: is it possible to do what I'm trying to do?
    If not, what would your collective minds suggest is the best idea?
    If so, how do I do it? Are there tutorials online that I can follow through? If not, can someone instruct me on how to get started?
    Your assistance is appreciated!
    AJ

    First place to start with InDesign is this book: http://amzn.to/biUyIZ
    You can also check out Lynda.com. For $25/month you can't beat it.
    That said, yes, what you want to do can be done by creating a template, but you'll need to give your clients very specific instructions on how to create the PDFs that you'll want to drop into your book.
    One last suggestion, have a talk your boss about expectations. Buying InDesign doesn't make you a designer and more than going to Home Depot and buying tools will make you a carpenter. Learning ID will take some time.
    FWIW, I do offer remote training sessions, if you boss is so inclined to pay for it. You can find my contact info on my website, www.theindesignguy.com
    HTH,
    Bob

  • How do I drag and drop from LR to InDesign?

    I read somewhere on a forum (maybe this one?) that you can drag and drop photos directly from LR to InDesign.
    I have LR 4 and InDesign CS6.  No matter what I try, I can't figure out how to drag and drop files from LR4 to InDesignCS6.  I always get a "cannot" icon appear in LR.
    I try to drag-n-drop PSD and JPG files from LR to inDesign. 
    Is it possible to do?
    Thank you,

    PS. I also tried drag-and-dropping to Photoshop, and it doesn't work either.
    I did more research online, and the more I research this, the more it seems that the LIGHTROOM DRAG AND DROP functionality works on MAC but not on PC...
    If it is the case, this would be a major annoyance.
    Some people said this feature worked on PC in Windows Vista.
    I tried running LR in compatibility more (Vista SP2), but this did not fix the issue.
    I am starting to wonder if this is a problem with LR running on WINDOWS x64 systems... (I am running WIN7 x64)

  • Dreamweaver CS3 Drag and Drop feature

    I have been trying to create  two links on my index.html page in Dreamweaver CS3.  However, after I have cut and pasted a whole image in place of a three part image my drag and drop feature will not turn off.  Each time I attempt to highlight the text on the page by dragging the cursor over the text the entire image moves.
    Please help.  I need to create links to other pages.

    Thanks for your reply.  I didn't realize until this morning that I had a
    response.  Here is the code pasted in this email below:
    code for Falaffelking.com
    <!--
    body {
    background-image: url(file:///C|/Documents and Settings/Sam
    Shamsedean/Desktop/Falaffel_King/Website/Background_Pattern.gif);
    background-image: url(Background_Pattern.gif);
    background-color: #00267f;
    .style1
    .style2 {font-family: Arial, Helvetica, sans-serif}
    body,td,th
    -->
    <!--
    function MM_preloadImages() { //v3.0
      var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
        var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length;
    i++)
        if (a.indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j].src=a;}}
    function MM_swapImgRestore() { //v3.0
      var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a)&&x.oSrc;i+)
    x.src=x.oSrc;
    function MM_findObj(n, d) { //v4.01
      var p,i,x;  if(!d) d=document;
    if((p=n.indexOf("?"))>0&&parent.frames.length) {
        d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
      if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++)
    x=d.forms+;
      for(i=0;!x&&d.layers&&i<d.layers.length;i++)
    x=MM_findObj(n,d.layers+.document);
      if(!x && d.getElementById) x=d.getElementById(n); return x;
    function MM_swapImage() { //v3.0
      var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array;
    for(i=0;i<(a.length-2);i+=3)
       if ((x=MM_findObj(a))!=null){document.MM_sr[j+]=x; if(!x.oSrc)
    x.oSrc=x.src; x.src=a[i+2];}
    //-->
        <!-- ImageReady Slices (FalaffelKing-HomePage.psd - Slices:
    Catering_Home_off) >      <! End ImageReady Slices -->
    Welcome to: FalaffelKing.com 2007©
    Larry Robinson
    248-214-4990
    email: [email protected]

  • Premiere Pro CS3: Can't drag and drop into project window

    I had been using PP CS3 with Windows 7 64-bit RC successfully for about half a year. Recently I did a clean install of the final, released version of Win 7, and now I cannot drag and drop into the project window.
    I am sure I used to be able to do this. Having to import every clip, instead of just dragging it from Bridge (CS4), is a major headache. Ok, a minor one. But is there anything I can do to regain this capability?
    Thanks,
    Ken

    Can I mark my own post as a "correct answer"? 
    I just discovered the problem isn't PP CS3 at all.
    The problem is Bridge CS4. Or, more accurately, how I am running it.
    In order to do drag and drop from Bridge, it needs to be executed in "Run as administrator" mode.
    So, fantastic! There is an quick, easy solution that works.

  • Is there a way to disable drag-and-drop on the pages panel?

    Hi, I'm using Indesign CS3 on Windows XP.  My computer is a laptop and the problem I'm having is that when I have the pages panel open, I have sometimes drag-and-dropped pages of a document into a new order without meaning to (the laptop touch pad seems made for these butterfingers-type moves).  The documents that I'm laying out are several hundred pages long, so sometimes I don't notice that I've screwed a few pages up until much later.  If there is any way to just turn this feature off, that would be great.  Due to the arrangement in which I usually work best (on a sofa), I would prefer not to have to attach an actual mouse to the laptop. Thank you for any help.

    Not that I know of.

  • Native Drag and Drop not working in CC

    Hello,
    I've been having trouble with migrating extensions from CS5.5 to CC (in flex for now). Especially with Native Drag events.
    For example NativeDragEnter event is not triggering when dragging something from swatch list to extension. When I drag something from the document itself, event gets triggered (but not every time, which is strange).
    Other elements of the extension are working.
    Everything is working fine in CS 5.5.
    I am using Extension Builder 2.1, building with flex sdk 3.4. Max target version of Creative Suite has been set to CS 7, so the extension should work in CC.
    Is anyone having similar problems? Some feedback would be appreciated.

    Have you found any solution since the time you posted? I am currently facing a similar problem with dragging with HTML/URL flavors in flex and dropping in InDesign?

  • Flash Drag and Drop Template in Captivate.  *HELP*

    Good morning.
    I am attempting to use the drag and drop learning interaction
    that comes pre-packaged with Flash CS3 and import it into Captivate
    for use in a Captivate based e-learning exercise.
    I create the drag and drop just fine in Flash, and it looks
    perfect when I publish it in Flash, etc.
    When I attempt to use the EXACT same SWF in Captivate,
    however, it does not work. I can move the drags around the screen,
    but they will not "drop" where they are supposed to.
    Thinking maybe I broke the template, I went ahead and just
    imported it 100% unchanged from Flash into Captivate (without me
    messing around with it changing things around) and it does the
    exact same thing.
    I have successfully used my own homemade flash "widgets" in
    Captivate, to include like click and reveal type interactions...for
    whatever reason, though, I can't get this one to work, even though
    I know it works perfectly in Flash.
    The .swf file was developed using ActionScript 2.0 in Flash
    and I tried publishing it with Flash 9 and Flash 8 as the setting,
    both do the same thing.
    Help!!!?
    Thanks.
    Rob

    Hi R
    Note that the Border simply adds space to the project so the
    playback controls aren't covering part of your movie. Assuming you
    want that to continue AND have a playback control, you might resize
    the project so the playback control is included in the main movie
    as well as being placed in an area that doesn't possibly obscure
    any screen activity.
    Cheers... Rick

  • 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                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

  • How to drag and drop a file with its Systemfile icon to a Jtext area

    I want to drag and drop a file to a JText area with its system file icon , but the problem is I cant show the file icon.
    Anyone knows this.
    this is my code.
    import java.awt.*;
    import java.awt.image.BufferedImage;
    import java.awt.datatransfer.DataFlavor;
    import java.awt.datatransfer.Transferable;
    import java.awt.dnd.DnDConstants;
    import java.awt.dnd.DropTarget;
    import java.awt.dnd.DropTargetDragEvent;
    import java.awt.dnd.DropTargetDropEvent;
    import java.awt.dnd.DropTargetEvent;
    import java.awt.dnd.DropTargetListener;
    import java.io.File;
    import javax.swing.*;
    import javax.swing.filechooser.FileSystemView;
    public class FileDrag extends JFrame implements DropTargetListener {
    DropTarget dt;
    File file;
    JTextArea ta;
    JLabel lbl;
    Graphics g;
    ImageIcon tmpIcon;
    public FileDrag() {
    super("Drop Test");
    setSize(300, 300);
    getContentPane().add(
    new JLabel("Drop a list from your file chooser here:"),
    BorderLayout.NORTH);
    ta = new JTextArea();
    ta.setBackground(Color.white);
    getContentPane().add(ta);
    dt = new DropTarget(ta, this);
    setVisible(true);
    public void dragEnter(DropTargetDragEvent dtde) {
    System.out.println("Drag Enter");
    public void dragExit(DropTargetEvent dte) {
    System.out.println("Source: " + dte.getSource());
    System.out.println("Drag Exit");
    public void dragOver(DropTargetDragEvent dtde) {
    System.out.println("Drag Over");
    public void dropActionChanged(DropTargetDragEvent dtde) {
    System.out.println("Drop Action Changed");
    public void drop(DropTargetDropEvent dtde) {
    FileSystemView view = FileSystemView.getFileSystemView();
    JLabel testb;
    Icon icon = null;
    Toolkit tk;
    Dimension dim;
    BufferedImage buff = null;
    try {
    Transferable tr = dtde.getTransferable();
    DataFlavor[] flavors = tr.getTransferDataFlavors();
    for (int i = 0; i < flavors.length; i++) {
    System.out.println("Possible flavor: " + flavors.getMimeType());
    if (flavors[i].isFlavorJavaFileListType()) {
    dtde.acceptDrop(DnDConstants.ACTION_COPY);
    ta.setText("Successful file list drop.\n\n");
    java.util.List list = (java.util.List) tr.getTransferData(flavors[i]);
    for (int j = 0; j < list.size(); j++) {
    System.out.println(list.get(j));
    file = (File) list.get(j);
    icon = view.getSystemIcon(file);
    ta.append(list.get(j) + "\n");
    ta.append("\n");
    tk = Toolkit.getDefaultToolkit();
    dim = tk.getBestCursorSize(icon.getIconWidth(), icon.getIconHeight());
    buff = new BufferedImage(dim.width, dim.height, BufferedImage.TYPE_INT_ARGB);
    icon.paintIcon(ta, buff.getGraphics(), 10, 10);
    repaint();
    dtde.dropComplete(true);
    return;
    System.out.println("Drop failed: " + dtde);
    dtde.rejectDrop();
    } catch (Exception e) {
    e.printStackTrace();
    dtde.rejectDrop();
    public static void main(String args[]) {
    new FileDrag();

    I want to drag and drop a file to a JText area with its system file icon , but the problem is I cant show the file icon.
    Anyone knows this.
    this is my code.
    import java.awt.*;
    import java.awt.image.BufferedImage;
    import java.awt.datatransfer.DataFlavor;
    import java.awt.datatransfer.Transferable;
    import java.awt.dnd.DnDConstants;
    import java.awt.dnd.DropTarget;
    import java.awt.dnd.DropTargetDragEvent;
    import java.awt.dnd.DropTargetDropEvent;
    import java.awt.dnd.DropTargetEvent;
    import java.awt.dnd.DropTargetListener;
    import java.io.File;
    import javax.swing.*;
    import javax.swing.filechooser.FileSystemView;
    public class FileDrag extends JFrame implements DropTargetListener {
    DropTarget dt;
    File file;
    JTextArea ta;
    JLabel lbl;
    Graphics g;
    ImageIcon tmpIcon;
    public FileDrag() {
    super("Drop Test");
    setSize(300, 300);
    getContentPane().add(
    new JLabel("Drop a list from your file chooser here:"),
    BorderLayout.NORTH);
    ta = new JTextArea();
    ta.setBackground(Color.white);
    getContentPane().add(ta);
    dt = new DropTarget(ta, this);
    setVisible(true);
    public void dragEnter(DropTargetDragEvent dtde) {
    System.out.println("Drag Enter");
    public void dragExit(DropTargetEvent dte) {
    System.out.println("Source: " + dte.getSource());
    System.out.println("Drag Exit");
    public void dragOver(DropTargetDragEvent dtde) {
    System.out.println("Drag Over");
    public void dropActionChanged(DropTargetDragEvent dtde) {
    System.out.println("Drop Action Changed");
    public void drop(DropTargetDropEvent dtde) {
    FileSystemView view = FileSystemView.getFileSystemView();
    JLabel testb;
    Icon icon = null;
    Toolkit tk;
    Dimension dim;
    BufferedImage buff = null;
    try {
    Transferable tr = dtde.getTransferable();
    DataFlavor[] flavors = tr.getTransferDataFlavors();
    for (int i = 0; i < flavors.length; i++) {
    System.out.println("Possible flavor: " + flavors.getMimeType());
    if (flavors[i].isFlavorJavaFileListType()) {
    dtde.acceptDrop(DnDConstants.ACTION_COPY);
    ta.setText("Successful file list drop.\n\n");
    java.util.List list = (java.util.List) tr.getTransferData(flavors[i]);
    for (int j = 0; j < list.size(); j++) {
    System.out.println(list.get(j));
    file = (File) list.get(j);
    icon = view.getSystemIcon(file);
    ta.append(list.get(j) + "\n");
    ta.append("\n");
    tk = Toolkit.getDefaultToolkit();
    dim = tk.getBestCursorSize(icon.getIconWidth(), icon.getIconHeight());
    buff = new BufferedImage(dim.width, dim.height, BufferedImage.TYPE_INT_ARGB);
    icon.paintIcon(ta, buff.getGraphics(), 10, 10);
    repaint();
    dtde.dropComplete(true);
    return;
    System.out.println("Drop failed: " + dtde);
    dtde.rejectDrop();
    } catch (Exception e) {
    e.printStackTrace();
    dtde.rejectDrop();
    public static void main(String args[]) {
    new FileDrag();

  • Illustrator Default PDF, if open in Acro Pro, drag and drop other .ai files, will they also....

    Hi! I'm trying to archive (for myself and others for easy access) about 50 fairly complex .ai files in a single Illustrator Default PDF and maintain editability and preserve layer and grouping integrity for every separate file, and, i'm probably going to have to do this hundreds of times (at least!) in the future. Once i save the initial first pdf file through Illustrator (wish didn't even have to do this, but seems no way to do in Bridge), then open the resulting pdf w Acrobat Pro, can i then just select an entire folder's worth of ai files in Bridge, drag and drop them into the pages panel and still have the dragged and dropped files also preserve all their AI info and layer/ group integrity? An if not, thinking if not based on 20 similar experiments, what's a fast way to do this. Doing this manually each time: opening each file in AI then saving as AI pdf, then combining and arranging them all after the fact, would be, well, fairly effed in terms of time, carpal tunnel, arthritis etc. Experimented w Bridge PDF Output batching (terrible rasterized lo-res results, but great for its intended purpose) and just dragging and dropping into Acrobat (lose complicated layer names and info, all flattened to single layer). Any help most appreciated, and as i do not have regular access to das interwebs  (i live on a boat) would appreciate and heed gentle admonishment if i've misposted or broached any community etiquette here. I've researched this as well as i can but can't find anything efficient/ elegant not involving InDesign, and even then the details are skimpy. Thank You! Getting mentally exhausted and not a little loopy. Keep in mind had to teach myself both Illustrator, Acrobat etc with access to the very limited offline help menus (the boat), so a complex answer involving learning InDesign would be learning curve can't even imagine with everything else struggling to do. But if you're willing to babystep diagram it out for me or can find me a link that does i will not only be eternally grateful but will do my durndest to master it and pass it on....Thanks Again! lil mc szpf
    PS If it helps I'm running the diligent dogged dusty beloved workhorse CS4 Design Premium on 27" monitor 2010 Mac (OS X 10.6.8), and took advantage of rare housesitting net access to install all most recent updates of everything, i'm barely competent w AI, PS, BR and been tackling Acrobat for past couple of months now....

    im glad that somebody is atleast trying. perhaps i need to be more clear.
    i will step by step describe the issue in detail.
    1) i open an email that contains an attachment .dxf or .pdf
    2) i click on the attachment shown in the email and aprompt comes up asking if i want to open or save the attachment.
    3) i select save. (by default it saves to a downloads folder. but i have also chosen to use other folders (when i did that it wouldnt save them)
    4) i highlight the downloads arrow on the right top side of my browser and click it
    5) it pulls down a list of the files that i USED to be able to click and drag onto my destop, or anyplace i chose
    6) used to be when i clicked and held the left mouse button down on top of a file of my choosing it would highlight and as i began to drag, a ghost image would appear of the file i was dragging. showing a (/) symbol next to it showing i couldnt drop the file within the browser and a + simbol showing that i could drop the file when the file was hovering over a place where i could drop the file such as my desktop or other folder. now, when i click and hold on the file.... I DONT get anything. when i drag. nothing follows. while i am "dragging" in the area that is my browser, i get the pointy finger icon. as soon as i enter an area where i could have dropped the file as before, i get my standard cursor arrow.
    its really as if the drag and drop feature just dosent work IN FIREFOX.
    i can drag and drop files all day long everyplace else.

Maybe you are looking for