Starting from:

$15

Lab Assignment #10 Activities Solution

1. Answer the questions in the spaces provided or attach a sheet with your answers (be sure to label questions for proper credit) (2 points each, unless noted otherwise):
Question
Answer
a. What is the highest level class type that an instance of the Container class can hold?
b. If a GridLayout is initially setup to have 3 rows and 2 columns, how would 12 components be arranged?
c. What type of event(s) is/are generated from a JCheckBox object?
d. What Listener Interface should be implemented to handle mouse click events?
CIS 2571: Introduction to Java
Lab Assignment
College of DuPage 2 CREngland
Question
Answer
e. What is the name of the bytecode file generated for the single anonymous class listener in the TestClass.java file?
2. On your own, select any one of the following Chapter 16 Programming Exercises on pages 630 to 638 of your textbook:
• 16.12 Display a running fan
• 16.15 Racing car
• 16.33 Geometry: pendulum
Although each exercise displays a different graphic image, all applications must include the following for full credit:
a) Use radio buttons, Black, Red, and Blue, to control the color of the drawn graphic.
o The Black radio button changes the displayed graphic image to black
o The Red radio button changes the displayed graphic image to red
o The Blue radio button changes the displayed graphic image to blue
b) Use two buttons, Start and Stop, to control your animation.
o The Start button starts, or continues, animation
o The Stop button stops animation
c) Use two arrow keys, Up Arrow and Down Arrow, to control the speed of your animation.
o The Up Arrow increases the speed of your animation
o The Down Arrow decreases the speed of your animation
d) Use Graphics class methods to ‘draw’ your graphic image. Your images should use the display given with each textbook problem description.
e) Each problem must contain a separate class (from the main testing class) that draws and controls the animation (through ActionListeners):
o 16.12 Display a running fan  RunningFan
o 16.15 Racing car  RacingCar
o 16.33 Geometry: pendulum  Pendulum
CIS 2571: Introduction to Java
Lab Assignment
College of DuPage 3 CREngland
f) dd a block comment at the top of the file to identify your name, file, date, class, assignment, and short description of the included classes. Add block comments before any nested classes to identify and describe their purpose. Use proper code alignment for full credit.
g) Compile the source code until no errors are found.
• Common Errors: http://www.cs.armstrong.edu/liang/intro9e/debug.html
h) Run the Java bytecode and observe the results.
i) Attach a hardcopy printout of your source code file.
j) Attach a hardcopy printout of your output GUI display.
k) Create a .zip file containing only your .java source code files. Upload a copy of this .zip file to the appropriate assignment in Blackboard (this will be demonstrated during class).

More products