Create an applet ScoreKeeper that keeps track of the score in a football game. To display the scores, the applet will have four labels in the north area. Two of the labels will display the name of the team. The other two labels will display the current score of the teams. In the center of the application will be a number of buttons: one for each team, one for each of the three basic ways to score—touchdown, field goal, and safety—and three buttons for the events that can happen after a touchdown— one-point conversion, two-point conversion, and failed to convert. Initially, there will just be two text areas and an Accept Names button in the south area of the applet. The text areas will be used to enter the names of the two teams. When the button is clicked, the team names will appear in the

This application looks at how we can change the appearance by making components visible or invisible. The solution uses a number of methods whose job is just to set the visibility of the components. This abstraction helps simplify the actionPerformed method. The solution also uses getSource() to check which component generated the event as it simplifies the code a bit for the buttons that get labeled with the team names. It is relatively easy to change it so that it checks for the string instead.

See the code in ScoreKeeper.java.

Computer Science & Information Technology

You might also like to view...

Variable names are usually verbs because they describe actions.

Answer the following statement true (T) or false (F)

Computer Science & Information Technology

The part description is stored with the information about parts.

Answer the following statement true (T) or false (F)

Computer Science & Information Technology