CS361
Project 2
Dragging cards
due: Wednesday,
February 20, before class
Assignment
Add the following features to the Swing window that you created in Project 1:
- The cards should initially be in random order.
- The user should be able to click on any card and drag it around the window.
Details
- Initially, the four empty slots should be on the left end of each row, but the 52 cards should fill the remaining slots in random order.
- When you click on a card and start dragging it, it should smoothly move with the mouse as if you had stuck the mouse to the card at the point where you pressed the mouse button.
- While a card is being dragged, it should appear above all other cards in the JFrame.
- When you release the mouse button after dragging, the card should stay where it is.
- The empty spots (that is, the gray rectangles) should not be draggable.
- As always (including this project and all future projects), all your methods need to
have Javadoc style headers.
Extra Credit
- For one point extra credit, add the following feature: After a card has been dragged out of its original spot, that spot should look like an empty spot (a solid gray rectangle).
What to hand in
Hand in a hard copy
of all the source code files you created or modified and also zip up all source
code files and send the zip file to me
as an email attachment. See the course
web page on handing in assignments for further details.
For
fun: An Ambiguous Recommendation
"You will be lucky to get Ben to work for you."