Skip Navigation LinksPHP-Java-Contents

​​Programming Home Projects With Java 

Table of Contents


 
1. Introduction

 
Preview 1-1
Introducing Home Projects With Java 1-2
Requirements for Home Projects With Java 1-3
Downloading and Installing NetBeans 1-4
Testing the Installation 1-7
Getting Help with a Java Program 1-13
Structure of a Java Program 1-14
Structure of a Java GUI Application 1-15
Swing Controls 1-17
Stopwatch - Creating a Java Project with ​NetBeans 1-20
Stopwatch - Create a Frame 1-26
Saving Java Projects with ​NetBeans 1-29
NetBeans and Java Files 1-30
Create the User Interface 1-31
Stopwatch - Adding Controls 1-35
Adding Event Methods 1-41
Stopwatch - Writing Code 1-45
Chapter Review 1-53

 
2. Dual-Mode Stopwatch Project

 
Review and Preview 2-1
Project Design Considerations 2-2
Dual-Mode Stopwatch Project Preview 2-3
Frame Design – GridBagLayout Manager 2-7
Stopwatch Frame Design 2-12
Code Design – Initial to Running State 2-23
Code Design – Timer Object 2-26
Code Design – Update Display 2-29
Code Design – Running to Stopped State 2-32
Code Design – Stopped State 2-34
Dual-Mode Stopwatch Project Review 2-38
Dual-Mode Stopwatch Project Enhancements 2-39
Dual-Mode Stopwatch Project Java Code Listing 2-40

 
3. Consumer Loan Assistant Project

 
Review and Preview 3-1
Consumer Loan Assistant Project Preview 3-2
Loan Assistant Frame Design 3-7
Code Design – Switching Modes 3-21
Frame Design – Focus Traversal 3-25
Code Design – Computing Monthly Payment 3-28
Code Design – Computing Number of Payments 3-32
Code Design – Loan Analysis 3-36
Code Design – New Loan Analysis 3-42
Improving a Java Project 3-43
Code Design – Zero Interest 3-44
Code Design – Focus Transfer 3-46
Code Design – Input Validation 3-49
Confirm Dialog 3-53
Code Design – User Messages 3-58
Consumer Loan Assistant Project Review 3-68
Consumer Loan Assistant Project Enhancements 3-69
Consumer Loan Assistant Project Java Code Listing 3-70

 
4. Flash Card Math Quiz Project

 
Review and Preview 4-1
Flash Card Math Quiz Project Preview 4-2
Flash Card Math Frame Design 4-11
Code Design – Start Practice 4-36
Code Design – Problem Generation 4-40
Code Design – Obtaining Answer 4-48
Code Design – Choosing Problem Type and Factor 4-52
Code Design – Timing Options 4-54
Code Design – Presenting Results 4-65
Flash Card Math Quiz Project Review 4-68
Flash Card Math Quiz Project Enhancements 4-69
Flash Card Math Quiz Project Java Code Listing 4-70

 
5. Multiple Choice Exam Project

 
Review and Preview 5-1
Multiple Choice Exam Project Preview 5-2
Multiple Choice Exam Frame Design 5-16
Frame Design – Menu Options 5-29
Frame Design – Initialization 5-34
Code Design – Exam File Format 5-37
Code Design – Generating Exam Files 5-38
Code Design – Opening an Exam File 5-43
Code Design – Reading an Exam File 5-49
Code Design – Centering Comment Text 5-57
Code Design – Error Trapping and Handling 5-61
Frame Design – Selecting Options 5-65
Code Design – Start Exam 5-69
Code Design – Question Generation 5-72
Code Design – Checking Multiple Choice Answers 5-79
Code Design – Checking Type In Answers 5-87
Code Design – Checking Spelling 5-93
Code Design – Presenting Results 5-100
Multiple Choice Exam Project Review 5-102
Multiple Choice Exam Project Enhancements 5-103
Multiple Choice Exam Project Java Code Listing 5-104

 
6. Blackjack Card Game Project

 
Review and Preview 6-1
Blackjack Card Game Project Preview 6-2
Blackjack Frame Design 6-15
Code Design – Card Definition 6-32
Code Design – Card Shuffle 6-37
Code Design – Start New Game 6-40
Code Design – Start New Hand 6-42
Code Design – End Hand 6-45
Code Design – Display Dealer Card 6-46
Code Design – Display Player Card 6-48
Code Design – Deal New Hand 6-51
Code Design – Player ‘Hit’ 6-52
Code Design – Player ‘Stay’ 6-53
Blackjack Card Game Project Review 6-60
Blackjack Card Game Project Enhancements 6-62
Blackjack Card Game Java Code Listing 6-63

 
 

 
7. Weight Monitor Project

 
Review and Preview 7-1
Weight Monitor Project Preview 7-2
Tabbed Pane Control 7-9
Weight Monitor Frame Design 7-10
Frame Design – Weight Editor Panel 7-18
Code Design – New Weight File 7-29
Code Design – Entering Weights 7-32
Code Design – Editing Weights 7-42
Code Design – Saving Weight Files 7-46
Code Design – Opening Weight Files 7-53
Code Design – Configuration File 7-58
Frame Design – Weight Plot Panel 7-65
Code Design – Weight Plot 7-69
Code Design – Grid Lines 7-78
Code Design – Plot Labels 7-82
Code Design – Weight Plot Trend 7-88
Weight Monitor Project Review 7-96
Weight Monitor Project Enhancements 7-97
Weight Monitor Project Java Code Listing 7-98

 
8. Home Inventory Manager Project

 
Review and Preview 8-1
Home Inventory Manager Project Preview 8-2
Home Inventory Manager Frame Design 8-12
Frame Design – Toolbar 8-15
Frame Design – Entry Controls 8-24
Frame Design – Search Panel 8-37
Frame Design – Photo Panel 8-40
Form Design – Tab Order and Focus 8-43
Introduction to Object-Oriented Programming 8-48
Code Design – InventoryItem Class 8-50
Code Design – Inventory File Input 8-52
Code Design – Viewing Inventory Item 8-57
Code Design – Viewing Photo 8-62
Code Design – Item Navigation 8-65
Code Design – Inventory File Output 8-68
Code Design – Input Validation 8-70
Code Design – New Inventory Item 8-73
Code Design – Deleting Inventory Items 8-80
Code Design – Editing Inventory Items 8-82
Code Design – Inventory Item Search 8-86
Printing with Java 8-88
Printing Document Pages 8-91
Code Design – Printing the Inventory 8-95
Home Inventory Manager Project Preview 8-100
Home Inventory Manager Project Enhancements 8-101
Home Inventory Manager Java Code Listing 8-102

 
9. Snowball Toss Game Project

 
Review and Preview 9-1
Snowball Toss Game Project Preview 9-2
Snowball Toss Game Frame Design 9-7
Frame Design – Choosing Options 9-33
Code Design – Configuration Files 9-38
Animation with Java 9-41
Drawing Images with IconEdit 9-46
Displaying Icons with Java 9-49
Code Design – Sprite Class 9-53
Code Design – Start/Stop Game 9-58
Code Design – Moving the Tossers 9-65
Code Design – MovingSprite Class 9-69
Code Design – Throwing Snowballs 9-70
Code Design – Collision Detection 9-80
Code Design – Zombie Snowmen 9-84
Code Design – Playing Sounds 9-93
Code Design – One Player Game 9-101
Snowball Toss Game Project Review 9-110
Snowball Toss Game Project Enhancements 9-111
Snowball Toss Game Project Java Code Listing 9-112

 
Appendix. Distributing a Java Project

 
Preview A-1
Executable jar Files A-2
Creating a jar File in NetBeans A-3
Creating a jar File in Command Prompt A-10
Application Icons A-12
Using IconEdit A-15
Running a Project on Another Computer A-19
Program Installers A-23
Installing/Removing a Java Application A-30​