aspose file tools*
The moose likes Swing / AWT / SWT and the fly likes Drag and Drop from JList to JTable. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "Drag and Drop from JList to JTable." Watch "Drag and Drop from JList to JTable." New topic
Author

Drag and Drop from JList to JTable.

Atrus Greyor
Ranch Hand

Joined: Mar 07, 2004
Posts: 110
I'm trying to implement D&D so that I am able to drag items from a JList. The JList contains either text or images, and I want the image to appear in the cell. My problems are:

  • When I try to drag a text element, and drop it, a white square appears. If I double click on the cell, I can see the text element.
  • When I try to drag an image element, I can't. It won't even let me. It comes from the same list as my text elements, so I don't understand why I can drag items in the list that only have text, but not ones that only have an image.


  • Here is my TransferHandler....

    Atrus Greyor
    Ranch Hand

    Joined: Mar 07, 2004
    Posts: 110
    Is any other information needed to help answer this question, I'm really stumped.
    Paul Clapham
    Bartender

    Joined: Oct 14, 2005
    Posts: 18141
        
        8

    Actually, yes. I was about to copy your code and try to run it, but then I noticed it used several other classes which you didn't post.

    I'm not suggesting you should post those classes, though. I'm suggesting you should make a shorter example which exhibits the problem and which can actually be compiled and run by somebody else.
     
    I agree. Here's the link: http://aspose.com/file-tools
     
    subject: Drag and Drop from JList to JTable.
     
    Similar Threads
    Cannot add an image to JPanel. Nothing works:(
    TransferHandler to dnd files from OS desktop to JTable
    drag and drop DND click, then move??
    Pasting image in JTable cells
    Drag and Drop within the JTable