Java Gui For A Blackjack Game
1. Specification
Write a GUI for a system that plays one or more games of Blackjack; use the rules given in Appendix A. The basic operation of the GUI is described here, and snapshots are given in Appendix B. A complete executable version of the code is not provided to run, but 90% of the code is given.
1.1 Model code
The model code is located in the model package in the BlueJ project. It is the solution from assignment 1, adapted to use the GUI. There is no Dealer class: the dealer is an object of type Player. All console IO has been removed. The model code is complete, except for calls to update() that you have to add as needed.
1.2 GUI behaviour
The system asks for the number of players (not including the dealer) and their names, as in Appendix 1, but uses pop-up dialogue boxes. It then shows the game GUI.
The game GUI is one window with p + 1 panels: a panels for each player and one at the bottom for the dealer. These panels are all objects of the same class. A player panel has two parts: a status panel at left and an action panel at right. The status panel has two parts: bet data at the top and cards at the bottom. The bet data consists of the player name, stake, bet, and last action. A player is identified with a number and name, but the dealer is just called “Dealer”. The hand panel shows the cards in a player’s hand, from left to right as they are dealt.
The action panel for a normal player has three buttons labelled “Buy”, “Draw”, and “Sit”; these do the obvious things. The action panel for the dealer has three buttons labelled “Draw”, “Sit”, and “Again”. The system deals one card to each person, shows these cards in the hand panels, and then waits. The user (you) then gets a second card for each person by clicking on an action; a player has the choice to buy or draw, but the dealer can only draw a second card. When a player buys a card, the system asks for the buy amount with a pop-up dialogue box, subtracts the amount from the player’s stake, and adds the amount to the player’s bet. All amounts are shown with two decimal places. The action is shown at far right in the status panel, directly to the left of the action panel, in the form “Action: XXX”. The action button in the action panel is cleared after each choice.
If the dealer has BlackJack, the game ends and the dealer collects all the bets. The bet amounts are set to zero, and the player and dealer stakes are updated. If the dealer does not have BlackJack, then control returns to the first player, who (you) can choose to buy, draw, or sit.
A player continues until s/he decides to sit, or busts. If the player busts,


