setDragEnabled(true) in JList

R

RC

I want to drag rows up/down (for example, drag 3rd row to 1st row)
in JList. I setDragEnabled(true) for JList, but it doesn't work!

How do I drag rows in JList?

Thanks!
 
F

Fred Kleinschmidt

RC said:
I want to drag rows up/down (for example, drag 3rd row to 1st row)
in JList. I setDragEnabled(true) for JList, but it doesn't work!

How do I drag rows in JList?

Thanks!

setDragEnabled(true) allows the user to drag the selection in the list and
drop it in another component - not within the list itself.

You will have to add a mouse listener to the JList and re-arrange the items
yourself.
 
I

IchBin

RC said:
I want to drag rows up/down (for example, drag 3rd row to 1st row)
in JList. I setDragEnabled(true) for JList, but it doesn't work!

How do I drag rows in JList?

Thanks!

Take a look at these examples..
http://www.java2s.com/ExampleCode/Swing-JFC/Drag-Drop.htm

--

Thanks in Advance...
IchBin, Pocono Lake, Pa, USA
http://weconsultants.servebeer.com/JHackerAppManager
__________________________________________________________________________

'If there is one, Knowledge is the "Fountain of Youth"'
-William E. Taylor, Regular Guy (1952-)
 

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,780
Messages
2,569,611
Members
45,275
Latest member
Michaelachoda

Latest Threads

Top