问题
I would like to implement a game board in swing (needs to be a table, though about either jtable or gridlayout etc ...) where I will be able to drag and drop a picture on to this game board and all the cells that the picture fell on will get a notification that they were chosen.
Can anyone help with that? how do I get a couple of cells in a table know that an object was dropped on them?
回答1:
Have a look at this tutorial.
回答2:
I think you have to spent some time with Google. I found the following with a little time with Google.
- Introduction to DnD
- How to drag and drop with Java 2, Part 1
- How to drag and drop with Java 2, Part 2
- Drag and Drop Effects
Hope this helps :)
回答3:
Read this and if you have an more specific questions come back and ask them.
来源:https://stackoverflow.com/questions/8562743/swing-drag-and-drop