Win a copy of Java Concurrency Live Lessons this week in the Threads forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

which component i can use to put image on?  RSS feed

 
BJon Jo
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i want to drag icon from a tree and then drop on some component.
unfortunately i don't know which component can be used? Anybody know?
 
Nathan Pruett
Bartender
Posts: 4121
IntelliJ IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Probably JLabel would be fine, since you can just call setIcon() and get the icon onto the JLabel. You'd have to do this in the DropTargetListener or whatever that was attached to the JLabel. ( It's been a while since I've worked with Drag 'n Drop... so I'm not sure if this name (or mechanic) is entirly accurate.)

Take a look at the info on Drag 'n Drop over on Sun's website for more information.
 
Consider Paul's rocket mass heater.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!