SophiaPretty

(5)

$14/per page/Negotiable

About SophiaPretty

Levels Tought:
Elementary,Middle School,High School,College,University,PHD

Expertise:
Accounting,Algebra See all
Accounting,Algebra,Applied Sciences,Architecture and Design,Art & Design,Biology,Business & Finance,Calculus,Chemistry,Communications,Computer Science,Economics,Engineering,English,Environmental science,Essay writing Hide all
Teaching Since: Jul 2017
Last Sign in: 209 Weeks Ago, 3 Days Ago
Questions Answered: 15833
Tutorials Posted: 15827

Education

  • MBA,PHD, Juris Doctor
    Strayer,Devery,Harvard University
    Mar-1995 - Mar-2002

Experience

  • Manager Planning
    WalMart
    Mar-2001 - Feb-2009

Category > Computer Science Posted 09 Nov 2017 My Price 10.00

frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

basket.png

 

Hi, I am trying to obtain this output, using this model

 

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

      }

}

 

Attachments:

Answers

(5)
Status NEW Posted 09 Nov 2017 08:11 AM My Price 10.00

----------- He-----------llo----------- Si-----------r/M-----------ada-----------m -----------Tha-----------nk -----------you----------- fo-----------r y-----------our----------- in-----------ter-----------est----------- an-----------d b-----------uyi-----------ng -----------my -----------pos-----------ted----------- so-----------lut-----------ion-----------. P-----------lea-----------se -----------pin-----------g m-----------e o-----------n c-----------hat----------- I -----------am -----------onl-----------ine----------- or----------- in-----------box----------- me----------- a -----------mes-----------sag-----------e I----------- wi-----------ll -----------be -----------qui-----------ckl-----------y

Not Rated(0)