
PLEASE TYPE ONLY IF NOT TYPE THAN DO NOT DO THIS****
PLEASE FOLLOW THE CODE BELOW AND CODE ACCORD TO THAT***
An example of the JFrame subclass with main method is as follows:
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
public class NBAPlayoff extends JFrame {
private JTextField txtName;
private JTextField txtAge;
private NBATeam spurs;
private NBAcourtPanel court;
private JLabel lMax, lMin, lAvg, lNum;
public NBAPlayoff(){
spurs=new NBATeam("Spurs");
court=new NBAcourtPanel(spurs);
add(court, BorderLayout.CENTER);
JLabel lMax0=new JLabel("Max Age:");
lMax=new JLabel("");
JLabel lMin0=new JLabel("Min Age:");
lMin=new JLabel("");
JLabel lAvg0=new JLabel("Average Age:");
lAvg=new JLabel("");
JLabel lNum0=new JLabel("Number of Players:");
lNum =new JLabel("");
JPanel rp=new JPanel(new GridLayout(8, 1)); //right panel
rp.add(lNum0);rp.add(lNum);rp.add(lMax0);rp.add(lMax);
rp.add(lMin0);rp.add(lMin);rp.add(lAvg0);rp.add(lAvg);
add(rp, BorderLayout.EAST);
JLabel l1=new JLabel("Player Name:");
txtName= new JTextField();
txtName.setPreferredSize(new Dimension(120,24));
JLabel l2=new JLabel("Player Age:");
txtAge= new JTextField();
txtAge.setPreferredSize(new Dimension(120,24));
JButton jbtAdd=new JButton("Add A Player");
jbtAdd.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
int age=Integer.parseInt(txtAge.getText());
spurs.addAPlayer(txtName.getText(), age);
lMax.setText(spurs.getMaxAge()+"");
lMin.setText(spurs.getMinAge()+"");
lAvg.setText(spurs.getAvgAge()+"");
lNum.setText(spurs.getNumOfPlayer()+"");
court.repaint();
}});
JButton jbtClear= new JButton("Clear");
jbtClear.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
txtName.setText("");
txtAge.setText("");
}});
JPanel pBot=new JPanel();
pBot.add(l1); pBot.add(txtName); pBot.add(l2);pBot.add(txtAge); pBot.add(jbtAdd);pBot.add(jbtClear);
add(pBot, BorderLayout.SOUTH);
}
public static void main(String[] args) {
NBAPlayoff frame = new NBAPlayoff();
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.setLocationRelativeTo(null);
frame.setSize(800, 400);
frame.setVisible(true);
}
}


Trending nowThis is a popular solution!
Step by stepSolved in 3 steps with 1 images

- Please answer question. This is pertaining to Java programming language 3-20arrow_forward1 Java onlyarrow_forwardpublic class OfferedCourse extends Course { // TODO: Declare private fields // TODO: Define mutator methods - // setInstructorName(), setLocation(), setClassTime() // TODO: Define accessor methods - // getInstructorName(), getLocation(), getClassTime() } import java.util.Scanner; public class CourseInformation { public static void main(String[] args) { Scanner scnr = new Scanner(System.in); Course myCourse = new Course(); OfferedCourse myOfferedCourse = new OfferedCourse(); String courseNumber, courseTitle; String oCourseNumber, oCourseTitle, instructorName, location, classTime; courseNumber = scnr.nextLine(); courseTitle = scnr.nextLine(); oCourseNumber = scnr.nextLine(); oCourseTitle = scnr.nextLine(); instructorName = scnr.nextLine(); location = scnr.nextLine(); classTime = scnr.nextLine(); myCourse.setCourseNumber(courseNumber); myCourse.setCourseTitle(courseTitle);…arrow_forward
- 1. Create the main method using pythone to test the classes. #Create the class personTypefrom matplotlib.pyplot import phase_spectrum class personType: #create the class constructor def __init__(self,fName,lName): #Initialize the data members self.fName = fName self.lName = lName #Method to access def getFName(self): return self.fName def getLName(self): return self.lName #Method to manipulate the data members def setFName(self,fName): self.fName = fName def setLName(self,lName): self.lName = lName #Create the class Doctor Type inherit from personTypeclass doctorType(personType): #Create the constructor for the doctorType class def __init__(self, fName, lName,speciality="unknown"): super().__init__(fName, lName) self.speciality = speciality #Methods to access def getSpeciality(self): return self.speciality #Methods to manipulate def setSpeciality(self,spc):…arrow_forward8arrow_forward1 Jljull Create a class Student in java with the following :attributes Name Age MobileNo Level a. Declare an empty and a parameterized constructor .in student class b. Declare an accessor method displayStudent() to .show the student details c. Declare a mutator method updateAge() to update .the age of student by 2 years d. Create 2 objects sl and s2 and call the methods QupdateAge() and displayStudentarrow_forward
- Javaarrow_forwardCreate a UML class diagram of the application illustrating class hierarchy, collaboration, and the content of each class. There is only one class. There is a main method that calls four methods. I am not sure if I made the UML Class diagram correct. import java.util.Random; // import Random packageimport java.util.Scanner; // import Scanner Package public class SortArray{ // class name public static void main(String[] args) { //main method Scanner scanner = new Scanner(System.in); // creates object of the Scanner classint[] array = initializeArray(scanner); System.out.print("Array of randomly generated values: ");displayArray(array); // Prints unsorted array sortDescending(array); // sort the array in descending orderSystem.out.print("Values in desending order: ");displayArray(array); // prints the sorted array, should be in descending ordersortAscending(array); // sort the array in ascending orderSystem.out.print("Values in asending order: ");displayArray(array); // prints the…arrow_forwardIn Java!!!!!This is a multi-part question. Consider the following UML diagram on attached image: 1.Write Java classes corresponding to the UML diagram. 2. Write getters and setters for all classes 3. Write non-default constructors for each class that initializes all instance variables to values passed as arguments to the constructor 4. Write toString method for each class 5. Modify Vehicle class to maintain inventory (list of all vehicles created) and print the list. What variable(s) you need to add? What additional method(s) you need? What else needs to be modified in the Vehicle class? Do you need to modify any of the descendant classes and explain your answer (if not: why not; if yes, describe what changes). Vehicle {Abstract} manufacturer:String - color:String Car Truck TwoWheeler {Abstract} -numberOfDoors:int -numberOfAxels:int -passengerSeats:int -fuelType:String -fuelLevel:int -fuelType:String -numberOfSeats:int -fuelLevel:int Truck Motorcycle -numberOfAxels:int -fuelType:String…arrow_forward
- ^ Which of the following elements of a parent class are NOT be inherited by a child class in Java? Opublic constructors protected static attributes O protected static methods Oprivate attributes Opublic final methods public abstract methods Por CamScanner 04-26....pdf PDF CamScanner 04-26....pdf ^ CamScanner 04-26....pdfarrow_forwardJava prgm basedarrow_forward
- Database System ConceptsComputer ScienceISBN:9780078022159Author:Abraham Silberschatz Professor, Henry F. Korth, S. SudarshanPublisher:McGraw-Hill EducationStarting Out with Python (4th Edition)Computer ScienceISBN:9780134444321Author:Tony GaddisPublisher:PEARSONDigital Fundamentals (11th Edition)Computer ScienceISBN:9780132737968Author:Thomas L. FloydPublisher:PEARSON
- C How to Program (8th Edition)Computer ScienceISBN:9780133976892Author:Paul J. Deitel, Harvey DeitelPublisher:PEARSONDatabase Systems: Design, Implementation, & Manag...Computer ScienceISBN:9781337627900Author:Carlos Coronel, Steven MorrisPublisher:Cengage LearningProgrammable Logic ControllersComputer ScienceISBN:9780073373843Author:Frank D. PetruzellaPublisher:McGraw-Hill Education





