CORE JAVA 2 VOL I FUNDA, IT
[ Pobierz całość w formacie PDF ]
Core Java™ 2: Volume I–Fundamentals
Cay S. Horstmann
Gary Cornell
Publisher: Prentice Hall PTR
Fifth Edition December 01, 2000
ISBN: 0-13-089468-0, 832 pages
Ask any experienced Java programmer,
Core Java
delivers the real-world guidance you need
to accomplish even the most challenging tasks That’s why it’s been an international best seller
for five straight years.
Core Java 2, Volume 1-Fundamentals
covers the fundamentals of
Java 2 Platform Standard Edition, Version 1.3 and includes completely revised discussions of
object-oriented Java development, enhanced coverage of Swing user interface components,
and much more.
The fifth edition delivers even more of the robust, real-world programs previous editions are
famous for- updated to reflect JDK 1.3 deployment and performance enhancements.
Volume 1 includes thorough explanations of inner classes, dynamic proxy classes, exception
handling, debugging, the Java event model, Input/Output, and file management. For
experienced programmers,
Core Java 2, Volume 1-Fundamentals
sets the standard-again!
Table of Contents
List of Tables, Code Examples and Figures....................................................................... 1
Tables ................................................................................................................................. 1
Code Examples...................................................................................................................1
Figures ................................................................................................................................ 3
Preface ................................................................................................................................... 7
To the Reader ..................................................................................................................... 7
About This Book ................................................................................................................ 8
Conventions...................................................................................................................... 10
CD-ROM .......................................................................................................................... 11
Acknowledgments............................................................................................................... 12
Chapter 1. An Introduction to Java ................................................................................. 13
Java as a Programming Tool ............................................................................................ 13
Advantages of Java........................................................................................................... 14
The Java “White Paper” Buzzwords ................................................................................ 15
Java and the Internet......................................................................................................... 22
A Short History of Java .................................................................................................... 24
Common Misconceptions About Java.............................................................................. 26
Chapter 2. The Java Programming Environment .......................................................... 30
Installing the Java Software Development Kit................................................................. 30
Development Environments ............................................................................................. 34
Using the Command Line Tools ...................................................................................... 35
Using an Integrated Development Environment .............................................................. 38
Compiling and Running Programs from a Text Editor .................................................... 42
Graphical Applications..................................................................................................... 46
Applets ............................................................................................................................. 49
Chapter 3. Fundamental Programming Structures in Java .......................................... 54
A Simple Java Program.................................................................................................... 54
Comments......................................................................................................................... 57
Data Types........................................................................................................................ 58
Variables........................................................................................................................... 62
Assignments and Initializations ....................................................................................... 63
Operators .......................................................................................................................... 65
Strings............................................................................................................................... 73
Control Flow .................................................................................................................... 87
Big Numbers .................................................................................................................. 106
Arrays ............................................................................................................................. 108
Chapter 4. Objects and Classes....................................................................................... 123
Introduction to Object-Oriented Programming .............................................................. 123
Using Existing Classes ................................................................................................... 131
Building Your Own Classes ........................................................................................... 143
Static Fields and Methods .............................................................................................. 155
Method Parameters......................................................................................................... 161
Object Construction........................................................................................................ 168
Packages ......................................................................................................................... 177
Documentation Comments ............................................................................................. 187
Class Design Hints ......................................................................................................... 192
Chapter 5. Inheritance ..................................................................................................... 195
Extending Classes .......................................................................................................... 195
Object:
The Cosmic Superclass ................................................................................... 216
The
Class
Class ............................................................................................................. 240
Reflection ....................................................................................................................... 244
Design Hints for Inheritance .......................................................................................... 262
Chapter 6. Interfaces and Inner Classes ........................................................................ 265
Interfaces ........................................................................................................................ 265
Object Cloning ............................................................................................................... 276
Inner Classes .................................................................................................................. 282
Proxies ............................................................................................................................ 299
Chapter 7. Graphics Programming ................................................................................ 306
Introduction to Swing..................................................................................................... 306
Creating a Frame ............................................................................................................ 310
Frame Positioning .......................................................................................................... 314
Displaying Information in a Panel ................................................................................. 319
2D Shapes....................................................................................................................... 326
Colors ............................................................................................................................. 335
Text and Fonts ................................................................................................................ 340
Images ............................................................................................................................ 351
Chapter 8. Event Handling.............................................................................................. 358
Basics of Event Handling ............................................................................................... 358
The AWT Event Hierarchy ............................................................................................ 378
Semantic and Low-Level Events in the AWT ............................................................... 380
Low-Level Event Types ................................................................................................. 384
Actions ........................................................................................................................... 402
Multicasting.................................................................................................................... 411
The Event Queue ............................................................................................................ 414
Chapter 9. User Interface Components with Swing...................................................... 424
The Model-View-Controller Design Pattern.................................................................. 424
An Introduction to Layout Management ........................................................................ 430
Text Input ....................................................................................................................... 437
Making Choices.............................................................................................................. 464
Menus ............................................................................................................................. 488
Sophisticated Layout Management ................................................................................ 512
Dialog Boxes .................................................................................................................. 540
Chapter 10. Applets.......................................................................................................... 582
Applet Basics.................................................................................................................. 582
The Applet HTML Tags and Attributes ......................................................................... 600
Multimedia ..................................................................................................................... 614
The Applet Context ........................................................................................................ 617
JAR Files ........................................................................................................................ 628
Chapter 11. Exceptions and Debugging ......................................................................... 640
Dealing with Errors ........................................................................................................ 640
Catching Exceptions....................................................................................................... 648
Some Tips on Using Exceptions .................................................................................... 658
Debugging Techniques................................................................................................... 661
Using a Debugger........................................................................................................... 684
Chapter 12. Streams and Files ........................................................................................ 693
Streams ........................................................................................................................... 693
The Complete Stream Zoo ............................................................................................. 696
ZIP File Streams............................................................................................................. 718
Putting Streams to Use ................................................................................................... 727
Object Streams ............................................................................................................... 741
File Management............................................................................................................ 768
Appendix Java Keywords ................................................................................................ 776
[ Pobierz całość w formacie PDF ]
zanotowane.pl doc.pisz.pl pdf.pisz.pl lemansa.htw.pl
Core Java™ 2: Volume I–Fundamentals
Cay S. Horstmann
Gary Cornell
Publisher: Prentice Hall PTR
Fifth Edition December 01, 2000
ISBN: 0-13-089468-0, 832 pages
Ask any experienced Java programmer,
Core Java
delivers the real-world guidance you need
to accomplish even the most challenging tasks That’s why it’s been an international best seller
for five straight years.
Core Java 2, Volume 1-Fundamentals
covers the fundamentals of
Java 2 Platform Standard Edition, Version 1.3 and includes completely revised discussions of
object-oriented Java development, enhanced coverage of Swing user interface components,
and much more.
The fifth edition delivers even more of the robust, real-world programs previous editions are
famous for- updated to reflect JDK 1.3 deployment and performance enhancements.
Volume 1 includes thorough explanations of inner classes, dynamic proxy classes, exception
handling, debugging, the Java event model, Input/Output, and file management. For
experienced programmers,
Core Java 2, Volume 1-Fundamentals
sets the standard-again!
Table of Contents
List of Tables, Code Examples and Figures....................................................................... 1
Tables ................................................................................................................................. 1
Code Examples...................................................................................................................1
Figures ................................................................................................................................ 3
Preface ................................................................................................................................... 7
To the Reader ..................................................................................................................... 7
About This Book ................................................................................................................ 8
Conventions...................................................................................................................... 10
CD-ROM .......................................................................................................................... 11
Acknowledgments............................................................................................................... 12
Chapter 1. An Introduction to Java ................................................................................. 13
Java as a Programming Tool ............................................................................................ 13
Advantages of Java........................................................................................................... 14
The Java “White Paper” Buzzwords ................................................................................ 15
Java and the Internet......................................................................................................... 22
A Short History of Java .................................................................................................... 24
Common Misconceptions About Java.............................................................................. 26
Chapter 2. The Java Programming Environment .......................................................... 30
Installing the Java Software Development Kit................................................................. 30
Development Environments ............................................................................................. 34
Using the Command Line Tools ...................................................................................... 35
Using an Integrated Development Environment .............................................................. 38
Compiling and Running Programs from a Text Editor .................................................... 42
Graphical Applications..................................................................................................... 46
Applets ............................................................................................................................. 49
Chapter 3. Fundamental Programming Structures in Java .......................................... 54
A Simple Java Program.................................................................................................... 54
Comments......................................................................................................................... 57
Data Types........................................................................................................................ 58
Variables........................................................................................................................... 62
Assignments and Initializations ....................................................................................... 63
Operators .......................................................................................................................... 65
Strings............................................................................................................................... 73
Control Flow .................................................................................................................... 87
Big Numbers .................................................................................................................. 106
Arrays ............................................................................................................................. 108
Chapter 4. Objects and Classes....................................................................................... 123
Introduction to Object-Oriented Programming .............................................................. 123
Using Existing Classes ................................................................................................... 131
Building Your Own Classes ........................................................................................... 143
Static Fields and Methods .............................................................................................. 155
Method Parameters......................................................................................................... 161
Object Construction........................................................................................................ 168
Packages ......................................................................................................................... 177
Documentation Comments ............................................................................................. 187
Class Design Hints ......................................................................................................... 192
Chapter 5. Inheritance ..................................................................................................... 195
Extending Classes .......................................................................................................... 195
Object:
The Cosmic Superclass ................................................................................... 216
The
Class
Class ............................................................................................................. 240
Reflection ....................................................................................................................... 244
Design Hints for Inheritance .......................................................................................... 262
Chapter 6. Interfaces and Inner Classes ........................................................................ 265
Interfaces ........................................................................................................................ 265
Object Cloning ............................................................................................................... 276
Inner Classes .................................................................................................................. 282
Proxies ............................................................................................................................ 299
Chapter 7. Graphics Programming ................................................................................ 306
Introduction to Swing..................................................................................................... 306
Creating a Frame ............................................................................................................ 310
Frame Positioning .......................................................................................................... 314
Displaying Information in a Panel ................................................................................. 319
2D Shapes....................................................................................................................... 326
Colors ............................................................................................................................. 335
Text and Fonts ................................................................................................................ 340
Images ............................................................................................................................ 351
Chapter 8. Event Handling.............................................................................................. 358
Basics of Event Handling ............................................................................................... 358
The AWT Event Hierarchy ............................................................................................ 378
Semantic and Low-Level Events in the AWT ............................................................... 380
Low-Level Event Types ................................................................................................. 384
Actions ........................................................................................................................... 402
Multicasting.................................................................................................................... 411
The Event Queue ............................................................................................................ 414
Chapter 9. User Interface Components with Swing...................................................... 424
The Model-View-Controller Design Pattern.................................................................. 424
An Introduction to Layout Management ........................................................................ 430
Text Input ....................................................................................................................... 437
Making Choices.............................................................................................................. 464
Menus ............................................................................................................................. 488
Sophisticated Layout Management ................................................................................ 512
Dialog Boxes .................................................................................................................. 540
Chapter 10. Applets.......................................................................................................... 582
Applet Basics.................................................................................................................. 582
The Applet HTML Tags and Attributes ......................................................................... 600
Multimedia ..................................................................................................................... 614
The Applet Context ........................................................................................................ 617
JAR Files ........................................................................................................................ 628
Chapter 11. Exceptions and Debugging ......................................................................... 640
Dealing with Errors ........................................................................................................ 640
Catching Exceptions....................................................................................................... 648
Some Tips on Using Exceptions .................................................................................... 658
Debugging Techniques................................................................................................... 661
Using a Debugger........................................................................................................... 684
Chapter 12. Streams and Files ........................................................................................ 693
Streams ........................................................................................................................... 693
The Complete Stream Zoo ............................................................................................. 696
ZIP File Streams............................................................................................................. 718
Putting Streams to Use ................................................................................................... 727
Object Streams ............................................................................................................... 741
File Management............................................................................................................ 768
Appendix Java Keywords ................................................................................................ 776
[ Pobierz całość w formacie PDF ]