内容简介
Chapter 1 An Introduction to Java,
Java as a Programming Tool,
Advantages of Java,
The Java"White Paper"Buzzwords,
Simple,
Object Oriented,
Distributed,
Robust,
Secure,
Architecture Neutral,
Portable,
Interpreted,
HighPerformance,
Multithreaded,
Dynamic,
Java and the Internet,
A Short History of Java,
Common Misconceptions About Java,
Chapter 2 The Java Programming Environment,
Installing the Java Software Development Kit,
Settingthe Execution Path,
Installingthe Library Source and Documentation,
Installing the Core Java Program Examples,
Navigating the Java Directories,
Development Environments,
Using the Command Line Tools,
Troubleshooting Hints,
Using an Integrated Development Environment,
Locating Compilation Errors,
Compiling and Running Programs from a Text Editor,
Graphical Applications,
Applets,
Chapter 3 Fundamental Programming Structures in Java,
A Simple Java Program,
Comments,
Data Types,
Integers,
Floating-Point Types,
The Character Type,
Theboolean Type,
Variables,
Assignments and Initializations,
Constants,
Operators,
Increment and Decrement Operators,
Relational and boolean Operators,
Bitwise Operators,
Mathematical Functions and Constants,
Conversions Between Numeric Types,
Casts,
Parentheses and Operator Hierarchy,
Strings,
Concatenation,
Substrings,
String Editing,
Testing Strings for Equality,
Reading the On-line APIDocumentation,
Reading Input,
Formatting Output,
Control Flow,
Block Scope,
Conditional Statements,
Indeterminate Loops,
Determinate Loops,
Multiple Selections—the switch Statement,
Breaking Control Flow,
Big Numbers,
Arrays,
Array Initializers and Anonymous Arrays,
Copying Arrays,
Command Line Parameters,
Sorting an Array,
Multidimensional Arrays,
Ragged Arrays,
Chapter 4 Objects and Classes,
Introduction to Object-Oriented Programming,
The Vocabulary of OOP,
Objects,
Relationships Between Classes,
Contrasting OOP with Traditional Procedural Programming Techniques,
Using Existing Classes,
Objects and Object Variables,
The GregorianCalendar Class of the Java Library,
Building Your Own Classes,
An Employee Class,
Using Multiple Source Files,
Analyzing the Employee Class,
First Steps with Constructors,
The Methods of the Employee Class,
Method Access to Private Data,
Private Methods,
Final Instance Fields,
Static Fields and Methods,
Static Fields,
Constants,
Static Methods,
Factory Methods,
The main Method,
Method Parameters,
Object Construction,
Overloading,
Default Field Initialization,
Default Constructors,
Explicit Field Initialization,
Parameter Names,
Calling Another Constructor,
Initialization Blocks,
Object Destruction and the finalize Method,
Packages,
Using Packages,
Documentation Comments,
How to Insert Comments,
Class Comments,
Method Comments,
Field Comments,
General Comments,
Package and Overview Comments,
How to Extract Comments,
Class Deign Hints,
Chapter 5 Inheritance,
Extending Classes,
Inheritance Hierarchies,
Polymorphism,
Dynamic Binding,
Preventing Inheritance:Final Classes and Methods,
Casting,
Abstract Classes,
Protected Access,
object:The Cosmic Superclass,
The equals and toString methods,
Generic Programming,
Array Lists,
Obiect Wrappers,
The Class Class,
Reflection
Using Reflection to Analyze the Capabilities ofClasses,
Using Reflection to Analyze Objects at Run Time,
Using Reflection to Write Generic Array Code,
Method Pointers!,
Design Hints for Inheritance,
Chapter 6 Interfaces and Inner Classes,
Interfaces,
Properties of Interfaces,
Interfaces and Abstract Classes,
Interfaces and Callbacks,
Object Cloning,
Inner Classes,
Using an Inner Class to Access Object State,
Special Syntax Rules for Inner Classes,
Are Inher Classes Useful?Are They Actually Necessary?Are They Secure?,
Local Inner Classes,
Static Inner Classes,
Proxies,
Properties of Proxy Classes,
Chapter 7 Graphics Programming,
Introduction to Swing,
Creating a Frame,
Frame Positioning,
Displaying Information in a Panel,
2D Shapes,
Colors,
Filling Shapes,
Textand Fonts,
Images,
Chapter 8 Event Handling
Basics of Event Handling,
Example:Handling a button click,
Becoming Comfortable with Inner Classes,
Turning Components into Event Listeners,
Example:Changing the Laok and Feel,
Example:Capturing Window Events,
The AWT Event Hierarchy,
Semantic and Low-Level Events in the AWT,
Event Handling Summary,
Low-Level Event Types,
Keyboard Events,
Mouse Events,
Focus Events,
Actions,
Multicating,
The Event Queue,
Adding Custom Events,
Chapter 9 User Interface Components with Swing,
The Model-View-Controller Design Pattern,
A Model-Vuew-Controller Analysis of Swing Buttons,
An Introduction to Layout Management,
Borer Layout,
Panels,
Grid Layout,
Text Input,
Text Fields,
Password Fields,
Formatted Input Fields,
Text Areas,
Labels and Labeling Components,
Selecting and Editing Text,
Making Choices,
Check Boxes,
Radio Buttons,
Borders,
Combo Boxes,
Sliders,
The JSpinner Component,
Menus,
Building Menus,
Icons in Menu Items,
Check Box and Radio Button Menu Items,
Pop-up Menus,
Keyboard Mnemonics and Accelerators,
Enabling and Disabling Menu Items,
Tool Bars,
Tool Tips,
Sophistlcated Layout Management,
Box Layout,
The Grid Bag Layout,
The Spring Layout,
Using No Layout Manager,
Custom Layout Managers,
Traversal Order,
Dialog Boxes,
Option Dialogs,
Creating Dialogs,
Data Exchange,
File Dialogs,
Color Choosers,
Chapter 10 Deploying Applets and Applications,
Applet Basics,
A Simple Applet,
Viewing an Applet,
Converting Applications to Applets,
Life Cycle of an Applet,
Security Basics,
Pop-Up Windows in Applets,
The Applet HTML Tags and Attributes,
Applet Attributes for Positioning,
Applet Attributes for Code,
Applet Attributes for Java-Challenged Viewers,
The object Tag,
Passing Information to Applets,
Multimedia,
URLs,
Obtaining Multimedia Files,
The Applet Context,
Inter-Applet Communication,
Displaying Items in the Browser,
A Bookmark Applet,
It's an Applet.It's an Application.It's Both!,
JAR Files,
JAR Caching,
Packaging Applications,
The Manifest,
Self-Running JAR files,
Resources,
Optional Packages,
Sealing,
Java Web Start,
The JNLP API,
Storing Application Preferences,
Property Sets,
The Preferences API,
Chapter 11 Exceptions and Debugging,
Dealing with Errors,
The Classification ofExceptions,
Advertising the Exceptions That a Method Throws,
How to Throw an Exception,
Creating Exception Classes,
Catching Exceptions,
Catching Multiple Exceptions,
Rethrowing Exceptions,
Chained Exceptions,
Stack Frames,
A Final Look at Java Error and Exception Handling,
Some Tips on Using Exceptions,
Logging,
Basic Logging,
Advanced Logging,
Changing the Log Manager Configuration,
Localization,
Handlers,
Filters,
Formatters,
Assertions,
Enabling and Disabling Assertions,
Usage Hints for Assertions,
Debugging Techniques,
Useful Tricksfor Debugging,
Lsing a Console Window,
Tracing AWT Events,
The AWT Robat,
Profiling,
Coverage Testing,
Using a Debugger,
The JDB Debugger,
The Sun ONE Studio Debugger,
Chapter 12 Streams and Files,
Streams,
Reading and Writing Bytes,
The Complete Stream Zoo,
Layering Stream Filters,
Data Streams,
Random-Access File Streams,
ZIP File Streams,
Putting Streams to Use,
Writing Delimited Output,
String Tokenizers and Delimited Text,
Reading Delimited Input,
Random-Access Streams,
Object Streams,
Storing Objects of Variable Type,
Object Serializatian File Format,
The Problem of Saving Object References,
Output Format fof Object References,
Modifying the Default Serialization Mechanism,
Serializing Typesafe Enumerations,
Versioning,
Using Serialization for Cloning,
File Management,
New I/O,
Memory-MappedFiles,
File Locking,
Regular Expressions,
Appendix,
Index,