taoujouti / macwidgets

Automatically exported from code.google.com/p/macwidgets
0 stars 0 forks source link

Drag-n-Drop for SourceList #65

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
Is it possible to get some drag-and-drop features to the SourceList?
I see in the Doc that there is a setTransferHandler. But I can't really get
it working. 

Thanks.

Original issue reported on code.google.com by mikaelbre@gmail.com on 9 Mar 2009 at 6:56

GoogleCodeExporter commented 9 years ago
Could you attach the code that you tried to this issue? Thanks.

Original comment by kenneth....@gmail.com on 14 Mar 2009 at 11:04

GoogleCodeExporter commented 9 years ago
Well, It might be some rookie mistakes from me, but I remember reading on your 
blog (comments) that if we 
wanted drag and drop, an issue should be made. 

First i tried basic drag-and-drop (with a setTransferHandler), but always 
seemed to get a NullPointerException. I 
haven't had much experience with doing drag-and-drop or GUI programming, so I 
figured there should be a 
setDropTarget or something. But I might be mistaking. In wich case, I'm 
terrably sorry for your time.

I've attached a code, mostly from Suns example pages.  

By the way, I really love this widgets. Ordenary Java GUI doesn't stand a 
chance. 

Original comment by mikaelbre@gmail.com on 14 Mar 2009 at 11:17

Attachments:

GoogleCodeExporter commented 9 years ago
Oh, I forgot to mention that I got the NullPointerException when draging the 
mouse with the drag-items, over 
the categories where I set .setShowDropLocation(false). Also, my code required 
JRE 1.6. I'd hope for 1.5.

Original comment by mikaelbre@gmail.com on 14 Mar 2009 at 11:20

GoogleCodeExporter commented 9 years ago
I haven't had time yet to look into this, but it's on my list.

Original comment by kenneth....@gmail.com on 18 Mar 2009 at 10:30

GoogleCodeExporter commented 9 years ago
I sort of found out about this one. The NullPointer Exception is throwed due to 
the transferhandler tries to 
select the previous selected item in the JTree. Since there was no previous 
selected item, the exception what 
tossed. 

I've gotten the transferhandler-example to work, but it still requires JDK 1.6 
to work, and with your current 
stable release of the macwidgets library the preferance-tab renders badly, and 
with the fix you posted on 
another issue, the darkSourceList-style isn't included. 

If you have another example on how to make drag-and-drop work, it would have 
been amazing. 

Thanks for your time. 

Original comment by mikaelbre@gmail.com on 18 Mar 2009 at 4:49