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);        } }

Microsoft Visual C#
7th Edition
ISBN:9781337102100
Author:Joyce, Farrell.
Publisher:Joyce, Farrell.
Chapter4: Making Decisions
Section: Chapter Questions
Problem 7E: Write a program named GuessingGame that generates a random number between 1 and 10. (In other words,...
icon
Related questions
Question

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);

       }

}

Program #1:
Write a program to simulate showing an NBA Team on a Basketball court.
Here is an example of the screenshot when running the program:
-O|
Number of Players:
5
Max Age:
Tony Parker
K. Leonard
32
T. Splitter
Min Age:
T. Duncan
M. Ginobili
21
Average Age:
28
Player Name: M. Ginobili
Player Age: 32
Add A Player
Clear
Transcribed Image Text:Program #1: Write a program to simulate showing an NBA Team on a Basketball court. Here is an example of the screenshot when running the program: -O| Number of Players: 5 Max Age: Tony Parker K. Leonard 32 T. Splitter Min Age: T. Duncan M. Ginobili 21 Average Age: 28 Player Name: M. Ginobili Player Age: 32 Add A Player Clear
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 3 steps with 1 images

Blurred answer
Knowledge Booster
Developing computer interface
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Microsoft Visual C#
Microsoft Visual C#
Computer Science
ISBN:
9781337102100
Author:
Joyce, Farrell.
Publisher:
Cengage Learning,
EBK JAVA PROGRAMMING
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781337671385
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT
C++ Programming: From Problem Analysis to Program…
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning