Drag and Drop in jdk1.4

Is there a way to override the drop that jdk1.4 now takes care of? Is there a way to still implement a drop() method like there was in jdk1.3?

sure, code your own TransferHandler, there you will find something like "public boolean importData(JComponent comp, Transferable t)". that's your drop()-method

Similar Messages

  • Drag and Drop with JDK1.4

    Hi There,
    I want to write an application with an toolbar with a few icons on it. when I drag a icon and drop on a panel it should create a new component[may be a label or a textfield] and place it on the panel. I should be able to drag and drop n number of components onto the panel and move that component in the panel and place them in the position required. Is this possible with java? In the example programs that I have worked with I can just drag and drop text from a textfield or label onto a label or a textfield or drag an image on a label and drop it onto another label.
    can anybody give some suggestions or help me with some information
    Thanks in advance

    Hi,
    Out of curiosity, have you implement it.
    Is it possible to send me the codes...
    cheers

  • Help needed in drag and drop of Flex tree

    Hi,
    We have an application which allows drag and drop between
    multiple
    trees and lists.
    Here are the steps I follow to refresh on drag and drop:
    1. Dispatch a custom event which calls server.
    2. On successful response from server I change the model
    which is
    data provider for the tree.
    3. Then, set a flag which triggers 'invalidateDisplayList'
    and 'invalidateList' for tree (and other listeners).
    4. The tree refreshes fine. But as soon as I drag and drop
    between
    trees again, I get this error in Tree.as:
    TypeError: Error #1010: A term is undefined and has no
    properties.
    at mx.controls::Tree/::updateDropData()
    at mx.controls::Tree/calculateDropIndex()
    at mx.controls.listClasses::ListBase/showDropFeedback()
    at mx.controls::Tree/showDropFeedback()
    The behaviour is weird, sometimes the browser hangs and stops
    responding.
    I am calling 'contentTree.showDropFeedback(event)' in my
    dragOver
    event listener which is triggering error.
    My tree data provider is a custom class which has 'children'
    array
    collection attribute.
    Any help on how to resolve this issue would be highly
    appreciated.
    Thanks in advance,
    Sujatha

    the major restrictions in its implemented only in
    jdk1.1.Why!

  • Help needed in Drag and Drop and  resizing of image icons

    Hi all,
    I'm doing a project on Drag and Drop and resizing of image icons.
    There is one DragContainer in which i have loaded the image icons and i want to drop these image icons on to the DropContainer.
    After Dropping these icons on to the DropContainer i need to resize them.
    I have used the Rectangle object in resizing.
    The problem now i'm facing is when i drag, drop and resize an image icon and when i try to drag, drop a second image icon the first image icon gets erased.
    can any one help me in fixing this error.
    if u want i can provide the source code.
    thanks in advance
    murali

    the major restrictions in its implemented only in
    jdk1.1.Why!

  • Drag and Drop from a screen device (:0.0) to another (:0.1)

    Hello,
    Working with JDK 1.4 I have used the drag and drop in order to drag objects from a JFrame displayed in the logical screen :0.0 to another one, working in the same JVM, but displayed in the logical screen :0.1. This work fine.
    Now, I'm usin the JDK 1.5. With the same code, the drag operation does not work. During the drag operation, I can not move the mouse from one screen to another. The mouse is "blocked" in the source logical screen. The same code works with the JDK1.4 ? I have searched in the forum and I don't find any post on that subject ?
    The drag and drop is not compliant with the JDk 1.4 ? What can I do to resolve this problem ?
    Thanks you for yours answers !!
    Bruno

    I have change my drag and drop implementation. The old one uses the DragGestureListener. Now, I just use the TransfertHandler.
    The result in exactly the same : When the mouse reach the screen border, you can not move it to the other screen...
    Can someone try whith its application ?
    Have someone have a solution.... It is very important for my project.
    Thanks a lot !
    Bruno

  • Drag and Drop Cursor changes - not working

    I have fully implemented a working drag and drop Swing application, but I am running into problems with the cursor.
    My application has some drop targets that set the cursor to DragSource.DefaultCopyNoDrop, and some that set it to DragSource.DefaultCopyDrop. The problem is once I change the cursor DefaultCopyDrop, I can never change it to NoDrop. I can however change it from NoDrop to Drop. I have tried it with jdk1.4 beta3 and rc.
    An example of this cursor behavior can be found at:
    http://www.javaworld.com/javaworld/jw-03-1999/jw-03-dragndrop.html
    I found some information related to this at:
    http://developer.java.sun.com/developer/bugParade/bugs/4407521.html
    I have tried using a null cursor in the startDrag method.
    Does anyone have a DND example where the cursor consistantly changes to give drop feedback that works with the DND in JDK1.4?
    Dave

    Hi, I also want to implement DND. I am using JRE1.3.1
    I am also facing the cursor change problem. i have passed null in the startDrag method. This problem get solved to some extent, but still many times cursor is not changing. I have created my dragSource and drag Target
    in the Constructor of my tree in a separate thread like
    // IN CONSTRUCTO OF TREE
    SwingUtilities.invokeLater( new Tree_DropTarget(this) );
    SwingUtilities.invokeLater( new TreeDragSource(this,
    DnDConstants.ACTION_MOVE) );
    Than in the target and source class
    publi clas Tree_DropTarget implements DropTargetListener,Runnable
    public Tree_DropTarget(JTree tree)
    m_dropTarget = tree;
    public void run ()
    try
    Thread.sleep(2000);
    catch (InterruptedException e)
    m_dropTarget = new DropTarget (m_targetTree, this);
    Same Way I have done for DragSource.
    Is anything wrong there???
    I am also facing 1 more proble, sometiems DND events are getting fired on navigating through the nodes, even though i am not dragging the node. And getting the Below exception some times
    java.lang.NullPointerExceptionat sun.awt.dnd.SunDropTargetContextPeer.handleMotionMessage(Unknown Source)
         at sun.awt.windows.WToolkit.eventLoop(Native Method)
         at sun.awt.windows.WToolkit.run(Unknown Source)
         at java.lang.Thread.run(Unknown Source)
    This exception I am not able to get who is throwing as all exceptions i am catching.
    Please help me, if u had any idea about these problems.

  • Drag and Drop between JTree and another component

    Hi,
    I have searched the forum for answer to this question but am not sure I found something similar to this. So, please help me out on this.
    I have a JTree and a JPanel, which basically shows images (as thumbnails) for the child nodes of one node in the tree heirarchy.
    I need to be able to drag and drop components from the JPanel to the JTree and vice versa, and of course, when you drop them on the tree, they should go under the correct node.
    I am using Swing 1.4.1, and have successfully implemented DnD in the JTree itself. But I am a little unclear about the DnD between the tree and the panel.
    Would really appreciate if someone could throw some light on this.
    Thanks a lot,
    Sri.

    Hi clairesheridan,
    thanks for your response. Your answer would have helped me if I was using JDK 1.3 but I am try to use the Swing API in jdk1.4.1, in which you have to set a transferhandler etc.
    Please let me know if you have any ideas or solutions.
    Thanks,
    sriharmya.

  • I want to Sync my iPhone 4 to iTunes however I get an error message from iTunes each time I connect the phone to the PC saying that I should restore to factory settings. Frustrating because it's already annoying enough that I can't drag and drop mp3's!!!

    I have never been so frustrated before in my life with any phone. I find it obnoxious as it is that I cannot simply drag and drop files (especially MP3's) straight from my PC directly into my phone, which I have been used to doing up until now. Everyone who convinced me to get the iPhone has instructed me that my frustration can be fixed by downloading iTunes and syncing it all up via that program (which I have never used before). So, I downloaded the program successfully, however when I connect the iPhone 4 to the PC and iTunes is open, I get an error message that 'iTunes cannot read the content of the iPhone "iPhone" and that I should go to the Preferences tab of the iPhone and select 'restore' to restore this phone to factory settings. First of all, I don't understand why I need to do that. I have already downloaded apps and other important things in the 2 days that I have the phone. I am also scared that it will erase my contacts. This is such a headache. Music is very imporatant to me, but I am getting so frustrated that I don't have freedom over the phone which I thought was supposed to be one of the best out there. I would really appreciate help in this matter. I am sure the phone is great but I am on the verge of taking it back and getting something else.

    Hey joshuafromisr,
    If you resintall iTunes, it should fix the issue. The following document will go over how to remove iTunes fully and then reinstall. Depending on what version of Windows you're running you'll either follow the directions here:
    Removing and Reinstalling iTunes, QuickTime, and other software components for Windows XP
    http://support.apple.com/kb/HT1925
    or here:
    Removing and reinstalling iTunes, QuickTime, and other software components for Windows Vista or Windows 7
    http://support.apple.com/kb/HT1923
    Best,
    David

  • When I drag and drop an icon from the address bar to the desktop is does creat the shortcut but will not display the website icon, only the firefox icon, how can I display website icons?

    When I drag and drop a website icon from the Forefox address bar to the desk top, the short cut is created but the icon that appears is the firefox Icon. I want to disply the icon from the website that the short cut refers to. I have checked all I can think of in my computer to no avail.

    You have to assign the favicon yourself to the desktop shortcut (right-click the shortcut: Properties) after you have dragged the link to the desktop.
    You can usually find the favicon in Tools >Page Info > Media and save the icon there.
    Otherwise use the main domain of the website and add favicon.ico (e.g. mozilla.com/favicon.ico ) to display the favicon in a tab and save that image to a folder.

  • Is there any way of dragging and dropping an iCal event showing in week view across to a date in the left sidebar monthly calendar?

    Hi, Im not a frequent forum poster, as most of my questions can be found already answered on them!
    This is a question Ive had for a long time and it amazes me that no-one else seems to ask it. I check at each OS upgrade but its never there...
    Is there any way of dragging and dropping an iCal event showing in week view across to a date in the left sidebar monthly calendar?
    I was able to do this years ago in MS Outlook, and utilized it all the time when I needed to push things back, now I have to open the event and select an new date in the drop-down calendar for each & every event I want to move to a new month at the end of the month.
    If its definitely not possible, how to you ask apple to consider including it - it doesnt seem like a particularly difficult task.
    Thankyou
    Andrew.

    Andrew,
    Is there any way of dragging and dropping an iCal event showing in week view across to a date in the left sidebar monthly calendar?
    No, but you can use cut/paste. Cut (⌘X) the event, then click on the week where you want to move the event, and Paste (⌘V).
    If you have a suggestion for Apple to change that method use: Apple - Mac OS X - Feedback.

  • Why does not drag and drop work?!

    Hello,
    I am trying to implent a drag and drop from a table to an icon representing a trash.
    The drop handler fails in converting the selected rows to a list:
    com.sun.el.MethodExpressionImpl@87d9c00d javax.el.ELException: java.lang.ClassCastException: java.lang.String cannot be cast to java.util.List
    Could you help me to understand why? Below are the details.
    This is the af:table:
    <af:table var="row" rowBandingInterval="0" id="t1"
    value="#{bindings.MyView1.collectionModel}"
    rowSelection="multiple"
    columnStretching="last"
    horizontalGridVisible="false"
    verticalGridVisible="false" fetchSize="-1"
    autoHeightRows="6" width="190"
    disableColumnReordering="true">
    <af:column sortable="true" headerText="Entry" id="c1"
    align="start">
    <af:outputText value="#{row.Description}" id="ot1"/>
    </af:column>
    <af:dragSource actions="MOVE" defaultAction="MOVE"
    discriminant="delete"/>
    </af:table>
    This is the drop area:
    <af:image source="Images/empty_trash_32.png" id="i2">
    <af:dropTarget dropListener="#{backingBeanScope.DropHandlerBean.dropHandler}"
    actions="MOVE">
    <af:dataFlavor flavorClass="org.apache.myfaces.trinidad.model.RowKeySet"
    discriminant="delete"/>
    </af:dropTarget>
    </af:image>
    This is the failing listener listener (the failing point is bold):
    public DnDAction dropHandler(DropEvent dropEvent) {
    DnDAction dnda = DnDAction.NONE;
    if (dropEvent.getProposedAction() == DnDAction.MOVE) { // delete
    RichTable table = (RichTable)dropEvent.getDragComponent();
    //determine the rows that are dragged over
    Transferable t = dropEvent.getTransferable();
    //when looking for data, use the same discriminator as defined
    //on the drag source
    DataFlavor<RowKeySet> df =
    DataFlavor.getDataFlavor(RowKeySet.class, "delete");
    RowKeySet rks = t.getData(df);
    if (rks == null) {
    return DnDAction.NONE;
    Iterator iter = rks.iterator();
    while (iter.hasNext()) {
    //get next selected row key
    System.out.println(rks.toArray().length); // the number of selected rows is ok
    List key = (List)iter.next(); // here gives: java.lang.ClassCastException: java.lang.String cannot be cast to java.util.List
    //make row current so we can access it
    table.setRowKey(key);
    //the table model represents its row by the ADF binding class,
    //which is JUCtrlHierNodeBinding
    JUCtrlHierNodeBinding rowBinding =
    (JUCtrlHierNodeBinding)table.getRowData();
    Row row = (Row)rowBinding.getRow();
    //delete row;
    row.remove();
    //activate animation
    dnda = DnDAction.MOVE;
    return dnda;
    thanks.

    I did try, I obtained this:
    java.lang.NullPointerException
    Why NullPointerException?
    I don't know if this helps, but consider that the collection model comes from a ViewObject built on three EOs with many fields, although the table only shows one column.
    This is the Iterator in my pageDef:
    <table IterBinding="MyView1Iterator" id="MyView1">
    <AttrNames>
    <Item Value="Cod1"/>
    <Item Value="Cod2"/>
    <Item Value="Cod3"/>
    <Item Value="Cod4"/>
    <Item Value="Description"/>
    <Item Value="Cod5"/>
    </AttrNames>
    </table>
    Any idea?
    I will see the Key content with the debugger.

  • Did my first back up today using external hard drive and time machine now i can't drag and drop

    Hi, i did my first back up today using time machine it all went onto my external hard drive fine. Now i cant drag and drop anyhting. I assume ive cahnged some settings in time machine but cant figure it out what to do can some one help ?
    thanks

    Brandbasher wrote:
    Thanks Pondini but i have closed time machine, removed external hard drive.
    Did you eject it first?
    Now i cant drag and drop anything on my desk top, or mail or any other application. Ive tried moving folders, documents none of it works. Even moving around documents within a folder, it wont let me chnage the position of files.
    That shouldn't be related to Time Machine (especially if the backups aren't mounted).
    What happens when you try those things?  Do you get any messages?  Anything you can post a screenshot of?
    Have you tried a Restart?
    Does it happen in another user account?  (If you don't have one, create one via System Prefs > Users & Groups.)

  • Drag and Drop (re-order) Thumbnails in Organizer

    I am using Photoshop Elements version 5.0.2
    I would like to re-order pictures in an order that will make sense for me in my business. I suppose I can go through each pix and change the time on them, so I can then sort by time stamp.
    Is there an easier way to do this? I was hopeful that I could drag and drop them in Thumbnail view - but I cannot.
    Thank you,
    Jamie

    >Is there anyway to delete the photos in the main well, without losing them from my collection?
    As I understand the design, the main well is intended to be all the photos that you are managing with Photoshop Elements.
    Collections are used to display a specific group of those photos in your chosen sequence for any given activity.
    I suspect that since you are using a consumer product such as Photoshop Elements for your business purpose, you may need to make some compromises like having a default (the main photo well) display sequence which you see first when starting PSE that is not what you would choose.
    This is not bad if PSE does what you want - just additional steps to switch to the Collection view and also to maintain (drag and drop) the sequencing of the collection when you add additional photo files to a Collection.

  • Problems with ListViews Drag and Drop

    I'm surprised that there isn't an Active X control that can do this more
    easily? Would
    be curious to find out if there is - although we aren't really embracing the
    use of
    them within Forte because it locks you into the Microsoft arena.
    ---------------------- Forwarded by Peggy Lynn Adrian/AM/LLY on 02/03/98 01:33
    PM ---------------------------
    "Stokesbary, Michael" <[email protected]> on 02/03/98 12:19:52 PM
    Please respond to "Stokesbary, Michael" <[email protected]>
    To: "'[email protected]'" <[email protected]>
    cc:
    Subject: Problems with ListViews Drag and Drop
    I am just curious as to other people's experiences with the ListView
    widget when elements in it are set to be draggable. In particular, I am
    currently trying to design an interface that looks a lot like Windows
    Explorer where a TreeView resides on the left side of the window and a
    ListView resides on the right side. Upon double clicking on the
    ListView, if the current node that was clicked on was a folder, then the
    TreeView expands this folder and the contents are then displayed in the
    ListView, otherwise, it was a file and it is brought up in Microsoft
    Word. All this works great if I don't have the elements in the ListView
    widget set to be draggable. If they are set to be draggable, then I am
    finding that the DoubleClick event seems to get registered twice along
    with the ObjectDrop event. This is not good because if I double click
    and the current node is a folder, then it will expand this folder in the
    TreeView, display the contents in the ListView, grab the node that is
    now displayed where that node used to be displayed and run the events
    for that as well. What this means, is that if this is a file, then Word
    is just launched and no big deal. Unfortunately, if this happens to be
    another directory, then the previous directory is dropped into this
    current directory and a recursive copy gets performed, giving me one
    heck of a deep directory tree for that folder.
    Has anybody else seen this, or am I the only lucky one to experience.
    If need be, I do have this exported in a .pex file if anybody needs to
    look at it more closely.
    Thanks in advance.
    Michael Stokesbary
    Software Engineer
    GTE Government Systems Corporation
    tel: (650) 966-2975
    e-mail: [email protected]

    here is the required code....
    private static class TreeDragGestureListener implements DragGestureListener {
         public void dragGestureRecognized(DragGestureEvent dragGestureEvent) {
         // Can only drag leafs
         JTree tree = (JTree) dragGestureEvent.getComponent();
         TreePath path = tree.getSelectionPath();
         if (path == null) {
              // Nothing selected, nothing to drag
              System.out.println("Nothing selected - beep");
              tree.getToolkit().beep();
         } else {
              DefaultMutableTreeNode selection = (DefaultMutableTreeNode) path
                   .getLastPathComponent();
              if (selection.isLeaf()) {
              TransferableTreeNode node = new TransferableTreeNode(
                   selection);
              dragGestureEvent.startDrag(DragSource.DefaultCopyDrop,
                   node, new MyDragSourceListener());
              } else {
              System.out.println("Not a leaf - beep");
              tree.getToolkit().beep();
    }

  • An mp3 file on my computer will not import to itunes by either the drag-and-drop or the Add File to Library method.  Can't figure out what I'm doing wrong.  My OS is Windows 7.

    I purchased an mp3 from a private website on my laptop.  The itunes library i sync ipod to is on my desktop, so i copied the mp3 onto a flash drive and then into my desktop in the Downloads folder and Desktop folder as well as the itunes music folder, 3 places.  I opened itunes on the desktop and read the instructions for importing music that's already in my computer.  Neither the drag-and-drop or the Add File to Library method works.  I've tried both ways over and over.  Cannot figure out what the problem is.  I do note that the name of the mp3 file doesn't show the .mp3 extension, it appears as simply it's title, Eating Healthy, without any extension at all.  Could the filename be the problem, or do you have any other idea what I'm doing wrong?  My OS is Windows 7, using IE9.  Thanks.
    ADDENDUM AFTER READING ANOTHER DISCUSSION HERE:  I have now tried right clicking the song in Windows Explorer and choosing Open With, clicking itunes.  The mp3 plays in itunes but does not add to the library.

    I don't have a Recently Added playlist.  However, I discovered that the file I had named Eating Healthy was given the name You Can Enjoy Eating Healthy when it copied to iTunes.  I'm guessing iTunes pulled the full name of the piece from the internet.  Upshot--the mp3 did transfer to iTunes on all 3 tries, but I was looking in my alphabetized list under E, not Y, so I didn't see it there.  Thanks for your help. 

Maybe you are looking for