Computer Bible Games with Java

Table of Contents

Course Description v
Course Prerequisites v
System Requirements vi
Installing and Using the Downloadable Solution Files vi
Using Computer Bible Game with Java vii
How To Take the Course vii
Forward by Ken B. Mitchell, Sr.Pastor, New Community Church viii

1. Introduction

Preview 1-1
Introducing Computer Bible Games With Java 1-2
Requirements for Computer Bible Games With Java 1-3
Testing the Installation 1-4
Getting Help with a Java Program 1-10
Structure of a Java Program 1-11
Structure of a Java GUI Application 1-12
Swing Controls 1-14
Stopwatch – Creating a Java Project with NetBeans 1-17
Stopwatch – Create a Frame 1-25
Saving Java Projects with NetBeans 1-28
NetBeans and Java Files 1-29
Create the User Interface 1-30
Stopwatch – Adding Controls 1-34
Adding Event Methods 1-40
Stopwatch – Writing Code 1-44
Chapter Review 1-52

2. Bible Safecracker Project

Review and Preview 2-1
Bible Safecracker Project Preview 2-2
Frame Design – GridBagLayout Manager 2-10
Bible Safecracker Frame Design 2-15
Code Design – Initializing Stopped State 2-36
Code Design – Stopped to Playing State 2-39
Code Design – Playing to Stopped State 2-42
Code Design – Generating Secret Combination 2-44
Code Design – Accepting Player Input 2-49
Code Design – Checking Player Input 2-54
Sounds in Java 2-59
Code Design – Adding Sounds 2-61
Bible Safecracker Project Review 2-68
Bible Safecracker Project Enhancements 2-69
Bible Safecracker Project Java Code Listing 2-70

3. Bible Tic Tac Toe Project

Review and Preview 3-1
Tic Tac Toe Project Preview 3-2
Tic Tac Toe Frame Design 3-10
Code Design – Initializing Stopped State 3-33
Code Design – Stopped to Playing State 3-36
Code Design – Playing to Stopped State 3-39
Code Design – Marking Grid 3-41
Code Design – Checking for Win 3-45
Code Design – Number of Players Selection 3-52
Code Design – Random Computer Moves 3-53
Code Design – Smart Computer Moves 3-58
Code Design – Adding Sounds 3-62
Tic Tac Toe Project Review 3-68
Tic Tac Toe Project Enhancements 3-69
Tic Tac Toe Project Java Code Listing 3-70
Bible Tic Tac Toe Trivia Game Enhancement 3-83
Code Design – Enlarge Form, Add New Controls 3-84
Code Design – Add Questions and Answers 3-88
Code Design – Display Question 3-94
Code Design – Answer Question 3-100
Play the Game 3-103
Code Design – One Last Change 3-109
Bible Tic Tac Toe Game Project Review 3-113

4. Bible Match Game Project

Review and Preview 4-1
Bible Match Game Project Preview 4-2
Bible Match Game Frame Design 4-10
Picture Selection 4-40
Code Design – Initializing Stopped State 4-43
Code Design – Integer Shuffling 4-50
Code Design – Stopped to Playing to Stopped State 4-54
Code Design – Displaying Pictures 4-60
Timer Object 4-67
Code Design – Adding Delays 4-70
Code Design – One Player, Solitaire Game 4-78
Code Design – Computer Moves 4-84
Code Design – Random Computer 4-91
Code Design – Smart Computer 4-96
Bible Match Game Project Review 4-108
Bible Match Game Project Improvements 4-109
Bible Match Game Project Java Code Listing 4-110

5. Noah’s Ark Project

Preview 5-1
Noah’s Ark Project Preview 5-2
Noah’s Ark Frame Design 5-6
Code Design – Initial State (Instructions) 5-17
Code Design – Select Number of Turtles 5-20
Code Design – Initial to Stopped State 5-22
Code Design – Stop the Program 5-27
Code Design – Selecting Turtles 5-28
Code Design – Stopped to Moving State 5-32
Noah’s Ark Project Review 5-37
Noah’s Ark Project Java Code Listing 5-38

6. Elijah and the Ravens Project

Preview 6-1
Elijah and the Ravens Project Preview 6-2
Elijah and the Ravens Frame Design 6-5
Code Design – Initial State (Instructions) 6-18
Code Design – Select Difficulty 6-21
Code Design – Position Elijah 6-23
Code Design – Position Raven and Bread 6-28
Code Design – Stop the Program 6-32
Code Design – Dropping Bread 6-33
Code Design – Moving Elijah 6-36
Code Design – Catching Bread 6-41
Code Design – Stop the Game 6-44
Elijah and the Ravens Project Review 6-48
Elijah and the Ravens Project Java Code Listing 6-49

7. Daniel and the Lions Project

Preview 7-1
Daniel and the Lions Project Preview 7-2
Daniel and the Lions Frame Design 7-10
Code Design – Initial State (Instructions) 7-40
Code Design – Select Difficulty 7-43
Code Design – Draw Grid 7-45
Code Design – Position Rocks 7-49
Code Design – Position Daniel and Lions 7-54
Code Design – Stop the Program 7-59
Code Design – Moving Daniel 7-60
Code Design – Moving Lions 7-67
Code Design – Shooting Prayers 7-75
Code Design – Stop the Game 7-84
Daniel and the Lions Project Review 7-85
Daniel and the Lions Project Java Code Listing 7-86

Appendix Installing Java & NetBeans for Windows or MAC