Java Programming

 

       

 

Friday, October 25th

 

Introduction to Event Driven Programming
What are some ways that you as a user interact with programs?
Each one of these is an event.
Events, Event Listeners and Event Handlers

Add the following Section 2-10 Vocabulary to your Java Definitions document:

- Symbols used to express a relationship between two expressions.
- To give a variable a name and to define the type of data the variable will contain.
- A place in memory where data of a specific type can be stored for later retrieval and use by your program.
- To assign a variable a value.
- Variables that store information about the object, such as color, width, height, and depth.

Begin Section 2: Lesson 10 - Variables slides.
Begin Section 2-10 Variables practice. Save the White Rabbit Project as 2-10 Random Hop. Save optional 1 activity as 2-10 Bunny Jazzercise.

Check with your instructor for special instructions before you begin Section 2-10 Variables project.
Steps for Section 2-10 Project.
Steps 1-8 - Random Head Shake
Steps 9-16 - Distance variable for the Swim procedure
Steps 17-25 - Adding a Parameter to the Swim procedure
Steps 26-28 - Using the Swim procedure for the Blue Tang fish
Steps 29-30 - Modifying Swim procedure and adding comments
Steps 30-47 - Refactoring your code by producing multiple procedures to reduce redundant code
Steps 30-36 - Creating the moveTail procedure
Steps 37-40 - Creating the moveFinsForward procedure
Steps 41-47 - Creating the moveFinsForward procedure
Steps 48-49 - Viewing the Java code
Steps 50-56 - Adding a loop
Steps 57-58 - Using your new procedures
Steps 59-61 - Adding Camera Movement
Steps 62-67 - Final modifications
Steps 68-70 - Adding Sound - stop after you add sound and demonstrate your program for teacher check.

Save the fish as Fish_10.
Note the following change to this section:
Step 44. This one is slightly different because it requires a parameter so make a dist parameter here exactly as you did before in step 18. Drag the parameter name over the red label to complete the procedure.

Add the following Section 2-11 Vocabulary to your Java Definitions document:

- Allow the user to control one or more objects with the keyboard keys while the animation is running.
- Any action initiated by the user that is designed to influence the program’s execution during play.
- Listen for, and react to, a keyboard keystroke that you specify.
- The act of coding events to handle each procedure.
- Procedures in the Scene class that listen for keyboard input while the animation is running.

Begin Section 2: Lesson 11 -Keyboard Controls slides.
Begin Section 2-11 Keyboard Controls practice. Save the White Rabbit Project as 2-11 Rabbit Keyboard. Save optional 1 activity as 2-11 Submarine. Save optional 2 activity as 2-11 Snow Yak.

Begin Section 2-11Keyboard Controls project. Save the fish as Fish_11.

 

Homework

Think of what kind of game you would like to produce now that you have keyboard controls.
 

What

Lesson 3: Using Procedures
• Toggle and describe the visual difference between the scene editor and code editor
• Correlate storyboard statements with program execution tasks
• Identify the correct procedure to move an object in a scene
• Use procedures to move objects in a scene
• Add Java programming procedures to the code editor
• Demonstrate how procedure values can be altered
• Add a control statement to the code editor
• Use random numbers to randomize motion

 

Why

Like a director, you will program objects to move and act, and make frequent changes as you go. You will need to know how to switch back and forth between the editors used to set up your scene and program your animation.

 

How

By completing the practice exercises.