Win a copy of Learn Spring Security (video course) this week in the Spring forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Can anyone help me with Drag and Drop in swing?

 
Max Diaz
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm trying to figure out how to enable drag and drop of JButtons between different JPanels. Basically I have a bunch of JButtons on screen whose only purpose is to display nice looking rectangles. I need to be able to drag any of the JButtons and drop them on a different JPanels. From what I gather about DnD in swing I need to set the transferhandler of the JPanels so they can accept JButtons dropped on them. According to the API the constructor for transferhandler accepts a Java Bean property. So you would pass in "text" to drag and drop text, but what do I pass in to drop a JButton?


Also what the hell is a Javabean?
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64613
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
"Max MaxMax", please check your private messages for an important administrative matter.
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64613
86
IntelliJ IDE Java jQuery Mac Mac OS X
 
Rob Camick
Ranch Hand
Posts: 2534
9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The section from the Swing tutorial on Drag and Drop might help.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic