Swing Project: Playing Card Manager

Job ID: 31873096

Budget: $30 – $250 USD

Swing Project: Playing Card Manager

In this project you will develop a GUI to allow the user to pick and display cards from a standard 52-card
deck. This project does not include the development of any specific game, but it could be used as a
platform on which to implement a game. You will download a zip file of images of playing cards. Each
.PNG file contains an image of a single card. The name of the file encodes the suit and face value of that
card. The relevant class to access the local file system from a Java application is java.io.File.

Part 1
Create an app that displays two components: a JButton labeled “Choose Card” and a CardImagePanel to
display a single card image, initially empty. When the JButton is clicked, it opens a JFileChooser dialog
that is initialized to display the contents of the card image file directory. When the user picks a file, the
file is displayed in the CardImagePanel. The button and card image panel are added to a generic JPanel
with the default FlowLayout layout manager.
In part 1, you are not loading and managing the entire card deck, so you do not need the enums or hash
map to manage the deck. You are only opening a single file, building a BufferedImage for it, and
displaying the image in a CardImagePanel. At this point it is not necessary to identify the card by suit
and face, you are simply picking a file with the file chooser and displaying the image from that file on the
GUI

Part 2
Create an app that displays two components: a JPanel called a CardChooserControl with internal
components to choose a card by suit and face, and a CardImagePanel to display the chosen card. The
CardChooserControl contains a JComboBox to select a face value, a JLabel with the text “of”, a
JComboBox to select a suit, and a JButton to fetch and display the chosen card. This design somewhat
simplifies the complexity of responding to events generated by each change in selection of a combo box.
The user configures the combo boxes, and can continue to change them without triggering any activity
until the button is clicked.

Part 3
This version is identical initially to Version 2. The new feature is, once the chosen card image is
displayed, the image can be moved around the display with mouse press and drag.
The JPanel that contains the control panel and card image panel will use absolute positioning and no
layout manager. The card image panel will use mouse listener and mouse motion listener to change the
location of the panel by dragging it with the mouse. When constructing the containing JPanel for the
GUI, use setLayout(null) to disable layout. The listeners will be added to the CardImagePanel class.
Since there is no layout manager for the main panel that displays the control panel and the card image
panel, all components must be given a size and a location initially. Location is up to the developer. Size
can easily be set based on the objects’ preferred size.

Part 4
This version will allow the user to pick 5 cards and display the 5 cards on the display area. When the
application launches, the full set of card images are loaded as before. Then the display area is initially
empty. A single menu named “Cards” with menu item “Choose” is provided. When the “Choose” menu
item is selected, it displays a custom dialog box to select five cards and an “OK” button to dismiss the
dialog. The five cards are then displayed in the main display area, and each card can be moved with
mouse press and drag.