How can i reorder rows in a Jtable using DnD?

F

farseer

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
 
F

farseer

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
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,731
Messages
2,569,432
Members
44,832
Latest member
GlennSmall

Latest Threads

Top