Hello. I've been using NetBeans for quite a while, and I really like the Draggable components that it uses. In both the GUI Builder & the GUI itself. So, my question is, How do you drag components around in the UI like that? I've looked into the java.awt.dnd package, and the tutorials don't really cover component dragging, just text dragging. If anyone has any tips or links to good tutorials, those would be awesome =).

Recommended Answers

All 2 Replies

http://zetcode.com/tutorials/javaswingtutorial/draganddrop/
Mix examples , for javax.swing.JButton use

DataFlavor  flavorButton = new DataFlavor("application/x-java-jvm-local-objectref; class=javax.swing.JButton");

an build own D&D.
google search "application/x-java-jvm-local-objectref"

=D Thanks a lot! That page has lots of info on it!
I'm going to leave this open for now in case others have stuff to add.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.