How can i reorder rows in a Jtable using DnD?

Discussion in 'Java' started by farseer, Jun 28, 2005.

  1. farseer

    farseer Guest

    There are plenty of discussion on drag and drop on the news net, but
    not many that give an example of how to implement re-ordering of JTable
    rows using drag & drop. Could someone point me to a quick overview of
    the moving parts that must be taken into account when trying to
    implement drag and drop (i.e. what sort of listeners do i need to
    implement and where do i need to do this?)

    Also, i am suing JDK 1.5. are there any new features/functions added
    that make the implementation of drag and drop simpler perhaps?

    thanks much
     
    farseer, Jun 28, 2005
    #1
    1. Advertising

  2. farseer

    farseer Guest

    i guess this is alot more difficult than i thought. Maybe we can start
    with just the "dragging".
    I can get simple dragging to occur by
    -calling JTable.setDragEnabled(true),
    -creating a TransferHandler and assigning it to JTable
    (JTable.setTransferHandler)

    With that, i can click on a row, then click it again and while holding
    the left mouse down, drag it. What i see is a "folder" icon being
    dragged. BUT, what i want to see is the ENTIRE row being picked up and
    dragged. How would i go about doing this?

    Do i have to now get into implementing DragGestureListener,
    DragSourceListener and DropTargetListener, or can i still do it using
    just the TransferHandler?
    If I need to implement these "Drag" Interfaces, what methods do i need
    to be concerned with if i want show a different icon when dragging (
    how would implement so that when a user drags, the entire row is
    dragged (visibly, you see the entire row picked up and dragged)).

    any suggestions would be appreciated
     
    farseer, Jun 28, 2005
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Ottfried
    Replies:
    1
    Views:
    4,914
    Ottfried
    Apr 9, 2004
  2. Tomer
    Replies:
    2
    Views:
    468
    Tomer
    Feb 9, 2005
  3. Timo Nentwig

    Java Swing DnD and Konqueror

    Timo Nentwig, Dec 24, 2004, in forum: Java
    Replies:
    0
    Views:
    329
    Timo Nentwig
    Dec 24, 2004
  4. Emiliano Molina

    wxPython DnD stops working after SetSizeHints

    Emiliano Molina, Jun 7, 2004, in forum: Python
    Replies:
    2
    Views:
    432
    Emiliano Molina
    Jun 8, 2004
  5. Replies:
    3
    Views:
    458
    Max Erickson
    Nov 10, 2005
Loading...

Share This Page