Answered step by step
Verified Expert Solution
Question
1 Approved Answer
I need to make a java class AiPlayerUi.Java that does the following: AiPlayerUi.java 1. 2. Create class AiPlayerUi so it uses class JPanel as the
I need to make a java class AiPlayerUi.Java that does the following:
AiPlayerUi.java 1. 2. Create class AiPlayerUi so it uses class JPanel as the superclass Add member variables of type a. AiPlayer ai b, int position; c. ArrayList Jabel> cards; 3. A custom constructor should be defined that receives a two parameters; one is data type class Player, the other is data type int Set member variable of type class AiPlayer to the parameter passed in of class Player using an explicit type cast Set member variable position to the parameter of data type int Call method initComponentso a. b. c. 4. Write method initComponents) to initialize all the components for the UI and be called from the constructor Set the size of the JPanel using two methods to ensure the UI isn't too small a. i. setMinimumSize0 ii. setPreferredSize0 Instantiate the member variable of data type ArrayList containing elements of class JLabel Using an if statement check if the position is 1 or 3 b. c. i. If true, set the layout manager to use BoxLayout so it is aligned on the Y axis ii. Else, set the layout manager to use Boxayout so it is aligned on the X axis d. Call method displayCardsO Write method displayCards to do the following 5. Loop through the member variable of data type ArrayList containing elements of class JLabel so there are 13 JLabels a. i. Instantiate an instance of class JLabel ii. Set the size of the JLabel iii. Add a border to the Label iv. Set the text of the JLabel to explicit text "Card" concatenated with the looping variable v. Add the JLabel to the ArrayList vi. Add the JLabel to the JPanelStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started