For this assignment students will continue developing the front end, or User Interface, portion of the Euchre game. Based on my professional experience working in the industry I have always had to develop a UI for every application, therefore I translate that experience to students so they can have the same opportunity and be prepared professionally.
Typically, there is a one-to-one correlation of back end functionality to front end UI component. Depending upon the design of the application it doesnt always correlate perfectly, however with Euchre, it works well.
Back-end functionality | Front-end UI component |
AiPlayer.java | AiPlayerUi.java |
Card.java | CardUi.java |
Game.java | GameUi.java |
HumanPlayer.java | HumanPlayerUi.java |
The goal is to develop the front-end components of the game Euchre by creating or updating classes:
- java
- java
- java
- java
The UI will be developed in multiple assignments, it is not expected that for Part 5 the fully functioning UI is complete.
The image that follows is a what my version of the UI will looks like. It does not have to be an exact match. The rubric will provide guidance and recommendations on how to accomplish this, however feel free to be creative in developing the look and feel of the UI.
To accomplish this:
- Reference the tasks below for the specifics of the source code requirements.
- Compress a project and submit to Webcourses
- Decompress compressed project and verify it is a Netbeans project
References
- docx
- Setting up a project in Netbeans.docx
- Netbeans right click menu help.docx
Deliverables
To complete this assignment, you must submit your compressed Netbeans project to Webcourses.
Please keep in mind that the tasks are guidance to accomplish the goals of the assignment. At times students will be required to do additional research (e.g. Google That S**T (GTS)!) to find implementation options. In the industry, software engineers are expected to be very self-sufficient to find the best solution for the task at hand.
I have provided multiple code examples on Webcourses that shows how to implement numerous of the tasks below, please reference those code examples prior to asking me for help!
Tasks and Rubric
Activity | ||
euchre package | ||
core package | ||
Game.java | 1. Update class to add the following member variablea. GameUi ui | |
2. Add method setGameUi to do the followinga. Return type voidb. One parameter of data type GameUic. Set member variable ui equal to parameter3. Add method getTeams to do the followinga. Return type ArrayList<Team>b. Empty parameter listc. Returns the member variable of data type ArrayList that contains elements of class Team4. Add method getTrump to do the followinga. Return type Cardb. Empty parameter listc. Returns the member variable of data type Card that represents the trump card for the dealt hand | ||
Player.java | 1. Update class to add the following member variablea. JPanel ui2. Generate a getter/setter for the member variable ui | |
images package | 1. Add package images to the project2. Add images for the cards to the package | |
userInterface package | ||
GameUi.java | 1. Update the class to add the following member variablesa. JPanel trumpPanel (if you added bidPanel in the last assignment, please rename it)b. JLabel teamOneScoreLblc. JLabel teamOneScored. JLabel teamTwoScoreLble. JLabel teamTwoScoref. JLabel trumpCard | |
2. Update initComponents to do the followinga. Instantiate the member variable of class ArrayList containing elements of class JLabel that represents the card each player plays on the table JPanelb. Loop through the four players and do the following1. Instantiate an instance of class JLabel2. Based on the position of the player set the size of the JLabel using class Dimension to be horizontal or vertical width and height3. Instantiate an instance of class CardUi passing the JLabel from step 1 as an argument4. Set the instance of class JLabel from step 1 equal to method call getLabel() on class CardUi5. Add the instance of class JLabel from step 1 to the member variable of call ArrayList containing element of class JLabel representing the cards played on the tablec. Add each instance of class JLabel stored in the ArrayList containing elements of class JLabel representing the cards played so that1. Human player JLabel for card played is in the SOUTH2. The remaining AI players have a JLabel placed in from of their position at the table | ||
AiPlayerUi.java | 1. Update the class to add the following member variables1. CardUi cardUi;2. int width;3. int height; | |
2. Update method initComponents() to do the followinga. Set the member variables width and height based on the orientation of the cards, vertical or horizontal | ||
3. Update method displayCards() to do the followinga. In the for loopi. Instantiate the instance of class CardUi passing as arguments1. The instance of class Card in the players hand at the looping variables index2. The instance of class JLabel created inside the for loop3. The Players position at the tableii. Set local variable of class JLabel representing the card equal to method call getLabel() on class CardUiiii. Comment out the call to method setText() on the instance of class JLabel | ||
HumanPlayerUi.java | 1. Update the class to add the following member variables1. CardUi cardUi; | |
2. Update method displayCards() to do the followinga. In the for loopi. Instantiate the instance of class CardUi passing as arguments1. The instance of class Card in the players hand at the looping variables index2. The instance of class JButton created inside the for loopii. Set local variable of class JButton representing the card equal to method call getButton() on class CardUiiii. Comment out the call to method setText() on the instance of class JButton | ||
CardUi.java | 1. Add member variablesa. Card card;b. ImageIcon imageIcon;c. JButton button;d. JLabel label;e. int position; | |
2. Generate getters for member variablesa. Of class JButtonb. Of class JLabel | ||
3. Write a custom constructor that do the followinga. Receives two parametersi. Class Cardii. Class JButtonb. Set member variable of class Card to the passed parameterc. Set member variable of class JButton to the passed parameterd. Call method selectFrontImage() | ||
4. Write a custom constructor that does the followinga. Receives three parametersi. Class Cardii. Class JLabeliii. Intb. Set member variable of class Card to the passed parameterc. Set member variable of class JLabel to the passed parameterd. Set member variable of primitive data type int to the passed parametere. Based on the position of the player call method selectVerticalBackImage() or selectHorizontalBackImage() | ||
5. Write a custom constructor that does the followinga. Received one parameter of class JLabelb. Set member variable of class JLabel to the passed parameterc. Calls method selectHorizontalBackImage() | ||
6. Write method selectFrontImage() to do the followinga. Instantiate an instance of class String to represent the file name of the image file set equal to explicit text ../images/b. Write a switch statement that evaluates the face of the instance of class Cardi. Based on the naming convention of your image files, concatenate to the String instantiated in step a with the appropriate valueii. For example, I named my files as such AceHearts, AceEuchre, AceDiamonds, AceClubsiii. Therefore, I concatenate to the String instance ../images/ the explicit text Acec. Write a switch statement that evaluates the suit of the instance of class Cardi. Based on the naming convention of your image files, concatenate to the String instantiated in step a with the appropriate valued. Concatenate the explicit file extension to the String instance that represents the filename based on your naming convention, the String instance should look something like ../images/AceClubs.png when finishede. Instantiate an instance of class URL set equal to the static method call getClass().getResource() passing the String instance as an argumentf. Using exception handling (i.e. in a try block)i. Check if the instance of class URL is not null1. If true, Instantiate the member variable of class ImageIcon passing the instance of class URL as an argument2. Instantiate the member variable of class JButton passing the instance of class ImageIcon as an argumentg. In the catch blocki. Output an error message that the resource if not foundii. Set the instance of class ImageIcon equal to null | ||
7. Write method selectVerticalBackImage() to do the followinga. Instantiate an instance of class String set to explicit text ../images/backVertical.jpg or whatever you named the back image of the cardb. Instantiate an instance of class URL set equal to the static method call getClass().getResource() passing the String instance as an argumentc. Using exception handling (i.e. in a try block)i. Check if the instance of class URL is not null1. If true, Instantiate the member variable of class ImageIcon passing the instance of class URL as an argument2. Instantiate the member variable of class JLabel passing the instance of class ImageIcon as an argumentd. In the catch blocki. Output an error message that the resource if not founde. Set the instance of class ImageIcon equal to null | ||
8. Write method selectHorizontalBackImage() to do the followinga. Instantiate an instance of class String set to explicit text ../images/backHorizontal.jpg or whatever you named the back image of the cardb. Instantiate an instance of class URL set equal to the static method call getClass().getResource() passing the String instance as an argumentc. Using exception handling (i.e. in a try block)i. Check if the instance of class URL is not null1. If true, Instantiate the member variable of class ImageIcon passing the instance of class URL as an argument2. Instantiate the member variable of class JLabel passing the instance of class ImageIcon as an argumentd. In the catch blocki. Output an error message that the resource if not foundii. Set the instance of class ImageIcon equal to null | ||
Euchre application | ||
Test Cases | Test Cases pass | |
Source compiles with no errors | ||
Source runs with no errors | ||
Source includes comments | ||
Total |
Perform the following test cases
Test Cases | ||
Action | Expected outcome | |
Test Case 1 | Rregression Testing: Initial JOptionPane displays | JOptionPane is similar to figure 1 |
Text Case 2 | Regression Testing: JOptionPane Prompts User Name | JOptionPane is similar to figure 2 |
Test Case 3 | Euchre Initial UI displays | Game UI looks similar figure 3 where:1. The human players cards show the appropriate image associated with each card in their hand2. The AI players cards show a back image3. The table has a place holder for each player when they play a card |
Test Case 4 | Project view | Project view matches figure 4 |
Figure 1 Intro JOptionPane
Figure 2 Prompt for Users Name
Figure 3 Euchre Initial UI
Figure 4 Project View
Reviews
There are no reviews yet.