Drag and Drop (Trying to do a copy but it does a Move instead)?

I have implemented drag and drop throughout my application and it works fine as long as I drag from a non-editable component (Table, TextArea, etc.) to an editable component (TextArea or TextField). However, When I drag and drop from an editable component to another editable component it does a move instead. How do I force it to do a copy? I looked at the description of exportAsDrag(JComponent comp, InputEvent e, int action) method and it even says for the action that no matter what you put in there "...the value may be changed during the course of the drag operation". What exactly causes this possible change and how do I prevent it from happening?
This is the constructor I currently have:
public TextAreaPanel(Document doc)
  super(doc);
  setMargin(new Insets(12,12,12,12));
  setDragEnabled(true);
  addMouseListener(new MouseAdapter()
    @Override public void mousePressed(MouseEvent e)
      if(e.getButton() != MouseEvent.BUTTON1)
        TextAreaPanel area = (TextAreaPanel)e.getSource();
        area.getTransferHandler().exportAsDrag(area, e, TransferHandler.COPY);
}I forgot to mention before. The location of the component having the text copied into it is in a different JInternalFrame than the one where the text is being copied from (not sure if that matters or not).
Edited by: Dont_Know on Jan 18, 2008 6:25 AM
Edited by: Dont_Know on Jan 18, 2008 6:28 AM

If your problem persists get yourself a micro USB cable (sold separately), you can restore your Apple TV from iTunes:
Remove ALL cables from Apple TV. (if you don't you will not see Apple TV in the iTunes Source list)
Connect the micro USB cable to the Apple TV and to your computer.
Open iTunes.
Select your Apple TV in the Source list, and then click Restore.

Similar Messages

  • My hard drive crashed on my MacBook Pro crashed and I need to get my CS5 up and running on the new hard drive. I copied what I could onto an external hard drive but when I drag and drop I get directions to uninstall but the uninstall folder I have does sa

    my hard drive crashed on my MacBook Pro crashed and I need to get my CS5 up and running on the new hard drive. I copied what I could onto an external hard drive but when I drag and drop I get directions to uninstall but the uninstall folder I have does says it is an alias that is no longer present. I get error 6. I would like to get my software up and running on the laptop again please

    If you subscribed to iTunes match the songs are kept in icloud. If you didn't but you did save the actual iTunes library folder which should include the music, video, etc.  you should be able to just drag this file back to your machine in the same place and when you open iTunes it will give you a chance to identify the iTunes library folder. 
    You can test this to find out if you saved the media files or not and don't need to attach your nano to do it. 
    You are correct that once you connect the nano it will clear the existing files from it and sync it with the new iTunes library. 
    If you don't have the media files i'm not sure if/how to get them back on a windows ipod.  I have everything backed up regularly because of the horror stories I have seen & heard.

  • I have lost my contacts on my IPhone5 and have tried to go into ICloud, but it does not accept my Apple password, I have changed the password many times.  What do I do?

    I completed the updates on my IPhone5, now I have lost my Contacts, I tried going into my ICloud, but the password that I use does not work (Apple Password).  I have changed it many many times and it still won't work.  The ICloud is trying to VERIFY, but stays at that point.

    Andrea Z. wrote:
    I have lost my iPhone on August 27, 2013 at 6:15 a.m. when I posizioned it on the strip for the scanner objet of Linate Airport.
    After about 10 minutes when I was already on the plane my friend tried to call my number but the phone was already off.
    By searching with the "Find my iPhone" system, the device is OFFLINE and does not appear on the map.
    I have already written to the lost property office of the Linate Airport but at the moment they do noto have yet responded.
    I have already forwarded the complaint to the police.
    How can I find out it if my iPhone 5 is offline?
    Thanks in advance for the answer.
    Andrea Z.
    29/08/2013

  • Why can't I drag and drop (or import in any way) my MPEG-4 or MOV Files? I am going crazy, going on 3 hours now!!!

    I have tuns of .mp4 clips, converted them to .mov clips... they successfully play in QuickTime. I cannot get them to go into iMovie. Seriously going crazy trying to make my sons 2 year birthday video. Someone please help me =(
    Thank you,
    anna

    annadex wrote:
    I have tuns of .mp4 clips, converted them to .mov clips... .
    How?
    easy way:
    • double-click mp4 to open it in QuicktimePlayer.app
    (does it play the video?)
    • File/Export/choose 720p (if optional, if not 480p)
    • import THAT into iMovie using iMovies import routine, proceed …

  • Canno drag and drop, copy or paste, adobe crash!!

    Hi. I got a Mac Book Pro Intel Core 2 10.5.8 from this morning i cannot drag and drop any files, I cannot copy or paste anything, anywhere. I've tried to fix permission, and disk but everything was worthless, any idea?

    try this http://support.apple.com/kb/ht1379

  • Media not copying into event when drag and dropped

    When I add media files into an event by dragging and dropping the file into the project the file does not get moved/copied 'Macintosh's HD Projects' folder.
    Is there a setting somewhere I can change so dragging and dropping behaves the same way as when I use CMD+I to import a file?
    I am using the most up-to-date version of FCPX in Mavericks.

    How are you determining this? And what version are you using? Media doesn't get copied to project folders; it get copied to Original Media sub folders in event folders. Or it gets left in its original location with aliases pointing to the actual media.
    If you're using 10.1, try dragging to the single-star event icon in the Library list pane and then look inside Original Media..
    Russ

  • Trying to drag and drop music in slideshow

    I want to play 4 songs from my itunes library to play in this long slideshow and when I click on to drag them down into custom playlist box it won't let me drag the music. It highlights multiple songs when I try to drag and drop. what the....am I doing wrong here

    I had the same problem.
    Instead of dragging the icon with a vertical movement to the bottom, start with a movement to the left to bring the icon outside the window, then go to the bottom, then to the right to bring the icon in the right place.
    In short : instead of "to the bottom", do "left, bottom, right".

  • How to drag and drop files in Time Machine Capsule?

    Hi, all
    I have recently bought a Time Machine 2 TB. I have backed up my MacBook Air over the Time Machine. I was trying to copy or drag and drop files in the time capsule, but it wont allow me. It Neither does allow me to create any new folders in the Airport Time Machine. If i try to drag and drop files in it, it says, click to Authenticate, however, there is no place or tab to authenticate. I am the administrator.
    Please advise.
    Thanks

    It sounds like you are trying to copy / paste files to the Time Capsule Finder icon, when you should be copying / pasting to the drive on the Time Capsule, which is named "Data" unless you have changed it.
    Open any Finder window and look for the Time Capsule icon under the Shared heading on the left side of the window
    Click on the Time Capsule, which will display a folder to the right named Data, unless you have changed the name of the drive
    Double-cllick on Data to mount the drive on the desktop
    You can drag / drop or copy / paste files onto the drive icon, or open the drive and drag files into the open window.
    The first time that you do this, you may be asked for the Time Capsule device or disk password.

  • 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                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

  • Unable to upload a file with Drag and Drop and http

    Hello,
    I am trying to upload a file through the web interface (Netscape 4.7 and IE 5.0). When I click un upload, Via Drag and Drop, a new window is started, but never completes.
    With Netscape, I get a message box: Netscape is unable to locate the server null. Please check the server name and try again.
    With IE 5, I get an error: This page can not be displayed.
    Are there any files I need to edit on the PC side to get this to work?
    Thanks
    Scott
    PS I think you guys are doing a great job with support on iFS.

    WebUI Drag & Drop requires FTP to be running and available.
    Drag & Drop is really just uses the browser built in FTP ability.

  • Drag and drop icons

    hello world....
    in the process of learning i'm trying to create a small java app that resizes and processes graphics, (using imagemagick api).
    what i'd like to be able to do is drag the icon (or shortcut) to my java app and then have the app process that, just as a windows app would do. in fact all i need really is the location of the file the user has dragged and dropped onto my app, although it would be nice if i could indicate somewhere that the file was being processed!
    i understand the use of the drag and drop re the text within java, but how do i go about dragging an external icon over a java app and having that pass me the file location (which is actually all i need...)
    thanks in advance!

    i understand the use of the drag and drop re the text
    within java, Are you sure?
    Read this:
    http://java.sun.com/docs/books/tutorial/uiswing/misc/dnd.html

  • Using drag and drop in remote desktop on windows server 2008

    we running an application on windows server 2008 terminal services .. this application was support drag and drop functionality .. i understand that terminal services on windows 2008 is supported to drag and drop but is not happening !! even when i run remote desktop connection on this server the drag and the drop is not working !
    i need to enable the drag and drop for windows 2008 terminal services  ..
    Thanks in advance

    Hello Ayman,
    If your requirement is to drag and drop files between local and remote sessions, Danny is right. Drag-and-drop feature is not supported in Windows Server 2008-based Terminal Server, which is a by-design behavior hard-coded in the current version of the Remote Desktop Protocol.
    As a workaround, I recommend you to use copy-and-paste function instead of drag-and-drop. To enable the copy-and-paste between local and remote session, please enable the clipboard redirection in Windows Server 2008-based RDC. (In Windows Server 2003 environment, local drive redirection is needed.)
    Hope it helps. Thanks.
    Best Regards,
    Lionel Chen

  • Drag and drop pdf files to Acrobat plug-in dialog

    Hi guys,
    I have an Acrobat plug-in application based on ASDK7 use MFC, it has a UI dialog could make user add files to the dialog.
    Now, I need to implement drag and drop files to the dialog.
    But the file is simply opened by Acrobat always when I drag&drop files.
    Drag&drop works fine in simple MFC project in Windows 7.
    Is there need any settings in Acrobat preference?
    Or how can I stealing drag acceptance from Acrobat App class in code?
    Thanks a lot!

    But Acrobat 9 also cannot work on my Windows XP enviroment.
    I also tried Acrobat 10 on Windows 7, not worked too.
    Thanks for your concerns. Regarding "I would recommend that you submit a formal support case with our Developer Support folks.", what should I do?

  • Drag and Drop in List View

    When in the List view in Finder, I would like to drag and drop a folder in Terminal to cd to that path. However, it does not appear that List view allows dragging and dropping at all even to copy files within Finder. Is it by design? I like List view because it allows me to see the tree view of folders like in Windows Explorer. Thanks.

    Works here. I've never had any issue selecting anything in list view (the only one I ever use in Finder windows) and dragging & dropping into a Terminal window and getting its path. Create a new admin user account, log into it, and see if the behavior persists.

  • Certain Numbers templets allow you to drag and drop contacts to populate cell data, how can I create that functionality in my own tables?

    Certain Numbers templets allow you to drag and drop contacts to populate cell data, how can I create that functionality in my own tables?

    If you haven't come across the workarounds thread you may find helpful tips there on this and other ways to work with Numbers 3.
    ronniefromcalifornia discovered how to bring contacts into Numbers 3. As described in this post:
    "Open Contacts
    Select all the cards you want
    Copy
    In Numbers, in a table, select cell A1
    Paste
    Boom. Works great. Even brought in the pictures. Cool."
    So instead of drag and drop, just select in Contacts, copy, and paste into Numbers
    SG

Maybe you are looking for