Results 1 to 6 of 6
  1. #1
    simmi is offline Member
    Join Date
    Apr 2009
    Posts
    29
    Rep Power
    0

    Smile Drag and Drop(URGENT)

    Hi,

    I am implementing drag and drop on jtables.Dragging jtable1 rows and dropping to jtable2 and vice-versa.I am facing following issues.

    --I need to make a check that when a row from jtable1 is dropped the operation is performed only if the drop place is jtable2 and vice-versa.

    -- I am able to do multiple selections but when i drag them mutiple selections are lost.Sometimes two consecutive rows are dragged but not always.

    --Also sometimes on just a single click on a row, the drag and drop operation is performed.

    --My jtable implements DragGestureListener, DragSourceListener,
    DropTargetListener

    and

    public void dragGestureRecognized(DragGestureEvent dge) {
    //some code
    //dge.startDrag method is then called.
    }
    public void dragDropEnd(DragSourceDropEvent dsde){
    }
    methods are implemented.


    Thanks a ton in advance,
    Simmi

  2. #2
    hardwired's Avatar
    hardwired is offline Senior Member
    Join Date
    Jul 2007
    Posts
    1,576
    Rep Power
    9

    Default

    The older AWT/underlying drag_and_drop classes don't work as well with Swing components as do TransferHandlers.
    Lesson: Drag and Drop and Data Transfer is a good reference.

  3. #3
    simmi is offline Member
    Join Date
    Apr 2009
    Posts
    29
    Rep Power
    0

    Default

    Hi....
    I am not able to figure out how to get the drop location or name of the component where the drop is made in my case jtable. I have set the name of both the tables and get the name of the source table but could not get the name of table where row is dropped.

    Any help on this will be appreciated.

    Thnx,
    Simmi

  4. #4
    hardwired's Avatar
    hardwired is offline Senior Member
    Join Date
    Jul 2007
    Posts
    1,576
    Rep Power
    9

    Default

    I am not able to figure out how to get the drop location or name of the component where the drop is made in my case jtable
    Did you set a TransferHandler on both of the JTables?

    Override the relevant TransferHandler methods and write code to get the behaviors you want. These are complex things to put together. Have you worked through the tutorial?

  5. #5
    Steve11235's Avatar
    Steve11235 is offline Senior Member
    Join Date
    Dec 2008
    Posts
    1,046
    Rep Power
    7

    Default

    Hardwired is correct on both counts. What you want to do is simple--once you do it the first time.

  6. #6
    simmi is offline Member
    Join Date
    Apr 2009
    Posts
    29
    Rep Power
    0

    Default Drop Location

    Hi,

    I am able to across two jtables but not able to get the target Jtable.i.e.get the jtable where the mouse was when drop was done.Though i have set the dropTargetListener for both the tables yet it gets activate dfor only the first one everytime irrespective of the jtable from where drag started.

    Thanks in advance..

Similar Threads

  1. Drag and drop
    By thayalan in forum AWT / Swing
    Replies: 1
    Last Post: 02-16-2009, 04:04 PM
  2. drag-drop in applet.
    By makpandian in forum Java Applets
    Replies: 0
    Last Post: 12-11-2008, 09:36 AM
  3. SWT DND (Drag and Drop) comprehensive Example
    By Java Tip in forum SWT Tips
    Replies: 0
    Last Post: 07-07-2008, 05:36 PM
  4. Drag and drop
    By abhivenugopal in forum JavaServer Pages (JSP) and JSTL
    Replies: 0
    Last Post: 01-30-2008, 03:10 PM
  5. help drag and drop in JTabbedPane
    By RO86 in forum AWT / Swing
    Replies: 0
    Last Post: 08-14-2007, 02:22 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •