| |
| |
Introduction | |
| |
| |
| |
Getting Started | |
| |
| |
| |
Becoming a Programmer | |
| |
| |
Choosing a Language | |
| |
| |
Telling the Computer What to Do | |
| |
| |
How Programs Work | |
| |
| |
How Programs Don't Work | |
| |
| |
Next Stop: Java | |
| |
| |
Workshop: Installing the Kit | |
| |
| |
| |
Writing Your First Program | |
| |
| |
What You Need to Write Programs | |
| |
| |
Creating the Saluton Program | |
| |
| |
Beginning the Program | |
| |
| |
Storing Information in a Variable | |
| |
| |
Saving the Finished Product | |
| |
| |
Compiling the Program into a Class File | |
| |
| |
Fixing Errors | |
| |
| |
Workshop: Running a Java Program | |
| |
| |
| |
Vacationing in Java | |
| |
| |
First Stop: Sun Microsystems | |
| |
| |
Going to School with Java | |
| |
| |
Lunch in JavaWorld | |
| |
| |
Taking in a Ballgame at ESPN.com | |
| |
| |
Getting Down to Business | |
| |
| |
Stopping by EarthWeb to Ask Directions | |
| |
| |
Workshop: Putting Java on Your Desktop | |
| |
| |
| |
Understanding How Java Programs Work | |
| |
| |
Creating an Application | |
| |
| |
Sending Arguments to Applications | |
| |
| |
Applet Basics | |
| |
| |
Sending Parameters to Applets | |
| |
| |
Workshop: Viewing the Code Used to Run Applets | |
| |
| |
| |
Learning the Basics of Programming | |
| |
| |
| |
Storing and Changing Information in a Program | |
| |
| |
Statements and Expressions | |
| |
| |
Assigning Variable Types | |
| |
| |
Naming Your Variables | |
| |
| |
Storing Information in Variables | |
| |
| |
Workshop: Using Expressions | |
| |
| |
All About Operators | |
| |
| |
| |
Using Strings to Communicate | |
| |
| |
Storing Text in Strings | |
| |
| |
Displaying Strings in Programs | |
| |
| |
Using Special Characters in Strings | |
| |
| |
Pasting Strings Together | |
| |
| |
Using Other Variables with Strings | |
| |
| |
Advanced String Handling | |
| |
| |
Workshop: Presenting Credits | |
| |
| |
| |
Using Conditional Tests to Make Decisions | |
| |
| |
Testing a Condition | |
| |
| |
if Statements | |
| |
| |
if-else Statements | |
| |
| |
switch Statements | |
| |
| |
The Conditional Operator | |
| |
| |
Workshop: Watching the Clock | |
| |
| |
| |
Repeating an Action with Loops | |
| |
| |
for Loops | |
| |
| |
while Loops | |
| |
| |
do-while Loops | |
| |
| |
Exiting a Loop | |
| |
| |
Naming a Loop | |
| |
| |
Workshop: Teaching Your Computer a Lesson | |
| |
| |
| |
Working with Information in New Ways | |
| |
| |
| |
Storing Information with Arrays | |
| |
| |
Creating Arrays | |
| |
| |
Using Arrays | |
| |
| |
Multidimensional Arrays | |
| |
| |
Sorting an Array | |
| |
| |
Workshop: Array of Prizes Indeed | |
| |
| |
| |
Creating Your First Object | |
| |
| |
How Object-Oriented Programming Works | |
| |
| |
Objects in Action | |
| |
| |
What Objects Are | |
| |
| |
Understanding Inheritance | |
| |
| |
Building an Inheritance Hierarchy | |
| |
| |
Converting Objects and Simple Variables | |
| |
| |
Workshop: Creating an Object | |
| |
| |
| |
Describing What Your Object Is Like | |
| |
| |
Creating Variables | |
| |
| |
Creating Class Variables | |
| |
| |
Creating Behavior with Methods | |
| |
| |
Putting One Class Inside Another | |
| |
| |
Using the this Keyword | |
| |
| |
Casting Objects and Converting Values | |
| |
| |
Workshop: Using Class Methods and Variables | |
| |
| |
| |
Making the Most of Existing Objects | |
| |
| |
The Power of Inheritance | |
| |
| |
Establishing Inheritance | |
| |
| |
Working with Existing Objects | |
| |
| |
Workshop: Creating a Subclass | |
| |
| |
| |
Programming a Graphical User Interface | |
| |
| |
| |
Building a Simple User Interface | |
| |
| |
Swing and the Abstract Windowing Toolkit | |
| |
| |
Using Components | |
| |
| |
Workshop: Creating Your Own Component | |
| |
| |
| |
Laying Out a User Interface | |
| |
| |
Using Layout Managers | |
| |
| |
Workshop: Laying Out an Application | |
| |
| |
| |
Responding to User Input | |
| |
| |
Getting Your Programs to Listen | |
| |
| |
Setting Up Components to Be Heard | |
| |
| |
Handling User Events | |
| |
| |
Workshop: A Little Lotto Madness | |
| |
| |
| |
Building a Complex User Interface | |
| |
| |
Scroll Panes | |
| |
| |
Sliders | |
| |
| |
Change Listeners | |
| |
| |
Workshop: Using Image Icons and Toolbars | |
| |
| |
| |
Moving into Advanced Topics | |
| |
| |
| |
Creating Interactive Web Programs | |
| |
| |
Standard Applet Methods | |
| |
| |
Putting an Applet on a Web Page | |
| |
| |
A Sample Applet | |
| |
| |
The Java Plug-in | |
| |
| |
Sending Parameters from a Web Page | |
| |
| |
Receiving Parameters in the Applet | |
| |
| |
Workshop: Handling Parameters in an Applet | |
| |
| |
| |
Handling Errors in a Program | |
| |
| |
Exceptions | |
| |
| |
Throwing Exceptions | |
| |
| |
Workshop: Throwing and Catching Exceptions | |
| |
| |
| |
Creating a Threaded Program | |
| |
| |
Threads | |
| |
| |
Working with Threads | |
| |
| |
Starting with init () | |
| |
| |
Catching Errors as You Set Up URLs | |
| |
| |
Handling Screen Updates in the paint () Method | |
| |
| |
Starting the Thread | |
| |
| |
Handling Mouse Clicks | |
| |
| |
Workshop: Revolving Links | |
| |
| |
| |
Reading and Writing Files | |
| |
| |
Streams | |
| |
| |
Writing Data to a Stream | |
| |
| |
Workshop: Writing Bytes to an MP3 File | |
| |
| |
| |
Creating Multimedia Programs | |
| |
| |
| |
Using Fonts and Color | |
| |
| |
Using the Font Class | |
| |
| |
Using the Color Class | |
| |
| |
Other Ways to Choose Colors | |
| |
| |
Workshop: Displaying a Danger Message | |
| |
| |
| |
Playing Sound Files | |
| |
| |
Retrieving and Using Sounds | |
| |
| |
Java Archives | |
| |
| |
Workshop: Making Your Computer Talk to You | |
| |
| |
| |
Working with Graphics | |
| |
| |
Using Graphics | |
| |
| |
Drawing Lines and Shapes | |
| |
| |
Workshop: Baking a Pie Graph | |
| |
| |
| |
Creating Animation | |
| |
| |
Animating a Sequence of Images | |
| |
| |
Sending Parameters to the Applet | |
| |
| |
Workshop: Follow the Bouncing Ball | |
| |
| |
| |
Appendixes | |
| |
| |
| |
Where to Go from Here: Java Resources | |
| |
| |
Other Books to Consider | |
| |
| |
Sun's Official Java Site | |
| |
| |
Other Java Web Sites | |
| |
| |
Java Newsgroups | |
| |
| |
Job Opportunities | |
| |
| |
| |
This Book's Web Site | |
| |
| |
| |
Configuring the Software Development Kit | |
| |
| |
Using a Command-Line Interface | |
| |
| |
Configuring the Software Development Kit | |
| |
| |
UNIX Configuration | |
| |
| |
| |
Using a Text Editor with the Software Development Kit | |
| |
| |
Choosing a Text Editor | |
| |
| |
Creating a File Association in Windows | |
| |
| |
Index | |