ebook img

Java in 21 Days PDF

1108 Pages·1996·6.554 MB·English
Save to my drive
Quick download
Download
Most books are stored in the elastic cloud where traffic is expensive. For this reason, we have a limit on daily download.

Preview Java in 21 Days

CONTENTS Teach Yourself Java in 21 Days Professional Reference Edition by Laura Lemay, Charles L. Perkins and Michael Morrison C O N T E N T S Introduction Day 1 An Introduction to Java Programming l W hat Is Java? l Ja va's Past, Present, and Future l W hy Learn Java? m J ava Is Platform Independent m J ava Is Object Oriented m J ava Is Easy to Learn l G etting Started Programming in Java m G etting a Java Development Environment m I nstalling the JDK and Sample Files m C onfiguring the JDK m C reating a Java Application m C reating a Java Applet l T roubleshooting l S ummary l Q &A Day 2 Object-Oriented Programming and Java l T hinking in Objects: An Analogy l O bjects and Classes l B ehavior and Attributes file:///G|/ebooks/1575211831/index.htm (1 of 37) [11/06/2000 7:44:37 PM] CONTENTS m A ttributes m B ehavior m C reating a Class l In heritance, Interfaces, and Packages m I nheritance m C reating a Class Hierarchy m H ow Inheritance Works m S ingle and Multiple Inheritance m I nterfaces and Packages m C reating a Subclass l S ummary l Q &A Day 3 Java Basics l S tatements and Expressions l V ariables and Data Types m D eclaring Variables m N otes on Variable Names m V ariable Types m A ssigning Values to Variables l C omments l L iterals m N umber Literals m B oolean Literals m C haracter Literals m S tring Literals l E xpressions and Operators m A rithmetic m M ore About Assignment m I ncrementing and Decrementing m C omparisons m L ogical Operators m B itwise Operators m O perator Precedence l S tring Arithmetic file:///G|/ebooks/1575211831/index.htm (2 of 37) [11/06/2000 7:44:37 PM] CONTENTS l S ummary l Q &A Day 4 Working with Objects l C reating New Objects m U sing new m W hat new Does m A Note on Memory Management l A ccessing and Setting Class and Instance Variables m G etting Values m C hanging Values m C lass Variables l C alling Methods m C lass Methods l R eferences to Objects l C asting and Converting Objects and Primitive Types m C asting Primitive Types m C asting Objects m C onverting Primitive Types to Objects and Vice Versa l O dds and Ends m C omparing Objects m D etermining the Class of an Object l C lass and Object Reflection (Java 1.1) l T he Java Class Library l S ummary l Q &A Day 5 Arrays, Conditionals, and Loops l A rrays m D eclaring Array Variables m C reating Array Objects m A ccessing Array Elements m C hanging Array Elements m M ultidimensional Arrays file:///G|/ebooks/1575211831/index.htm (3 of 37) [11/06/2000 7:44:37 PM] CONTENTS l B lock Statements l i f Conditionals m T he Conditional Operator l s witch Conditionals l f or Loops l w hile and do Loops m w hile Loops m d o...while Loops l B reaking Out of Loops m L abeled Loops l S ummary l Q &A Day 6 Creating Classes and Applications in Java l D efining Classes l C reating Instance and Class Variables m D efining Instance Variables m C onstants m C lass Variables l C reating Methods m D efining Methods m T he this Keyword m V ariable Scope and Method Definitions m P assing Arguments to Methods m C lass Methods l C reating Java Applications m H elper Classes l Ja va Applications and Command-Line Arguments m P assing Arguments to Java Programs m H andling Arguments in Your Java Program l S ummary l Q &A file:///G|/ebooks/1575211831/index.htm (4 of 37) [11/06/2000 7:44:37 PM] CONTENTS Day 7 More About Methods l C reating Methods with the Same Name, Different Arguments l C onstructor Methods m B asic Constructors m C alling Another Constructor m O verloading Constructors l O verriding Methods m C reating Methods That Override Existing Methods m C alling the Original Method m O verriding Constructors l F inalizer Methods l S ummary l Q &A Day 8 Java Applet Basics l H ow Applets and Applications Are Different l C reating Applets m M ajor Applet Activities m A Simple Applet l In cluding an Applet on a Web Page m T he <APPLET> Tag m T esting the Result m M aking Java Applets Available to the Web l M ore About the <APPLET> Tag m A LIGN m H SPACE and VSPACE m C ODE and CODEBASE l Ja va Archives l P assing Parameters to Applets l S ummary l Q &A file:///G|/ebooks/1575211831/index.htm (5 of 37) [11/06/2000 7:44:37 PM] CONTENTS Day 9 Graphics, Fonts, and Color l T he Graphics Class m T he Graphics Coordinate System l D rawing and Filling m L ines m R ectangles m P olygons m O vals m A rcs m A Simple Graphics Example m C opying and Clearing l T ext and Fonts m C reating Font Objects m D rawing Characters and Strings m F inding Out Information About a Font l C olor m U sing Color Objects m T esting and Setting the Current Colors m A Simple Color Example l S ummary l Q &A Day 10 Simple Animation and Threads l C reating Animation in Java m P ainting and Repainting m S tarting and Stopping an Applet's Execution m T he Missing Link: Threads m P utting It Together l T hreads: What They Are and Why You Need Them m W riting Applets with Threads m A nother Look at the Digital Clock l R educing Animation Flicker m F licker and How to Avoid It m H ow to Override update() file:///G|/ebooks/1575211831/index.htm (6 of 37) [11/06/2000 7:44:37 PM] CONTENTS m S olution One: Don't Clear the Screen m S olution Two: Redraw Only What You Have To l S ummary l Q &A Day 11 More Animation, Images, and Sound l R etrieving and Using Images m G etting Images m D rawing Images m A Note About Image Observers m M odifying Images l C reating Animation Using Images m A n Example: Neko l R etrieving and Using Sounds l U sing Animation Packages m S un's Animator Applet m D imension X's Liquid Motion l M ore About Flicker: Double-Buffering m C reating Applets with Double-Buffering m A Note on Disposing Graphics Contexts m A n Example: Checkers Revisited l S ummary l Q &A Day 12 Managing Simple Events and Interactivity l M ouse Clicks m M ouse Down and Mouse Up Events m A n Example: Spots m D ouble-Clicks l M ouse Movements m M ouse Drag and Mouse Move Events m M ouse Enter and Mouse Exit Events m A n Example: Drawing Lines m K eyboard Events file:///G|/ebooks/1575211831/index.htm (7 of 37) [11/06/2000 7:44:37 PM] CONTENTS m T he keyDown() and keyUp() Methods m D efault Keys m A n Example: Entering, Displaying, and Moving Characters m T esting for Modifier Keys and Multiple Mouse Buttons l T he awt Event Handler l S ummary l Q &A Day 13 Creating User Interfaces with the awt l A n awt Overview l T he Basic User Interface Components m L abels m B uttons m C heck Boxes m R adio Buttons m C hoice Menus m T ext Fields l P anels and Layout m L ayout Managers: An Overview m T he FlowLayout Class m G rid Layouts m B order Layouts m C ard Layouts m G rid Bag Layouts m I nsets l H andling UI Actions and Events l N esting Panels and Components m N ested Panels m E vents and Nested Panels l M ore UI Components m T ext Areas m S crolling Lists m S crollbars and Sliders m C anvases l M ore UI Events file:///G|/ebooks/1575211831/index.htm (8 of 37) [11/06/2000 7:44:37 PM] CONTENTS l F un with Components l A Complete Example: RGB-to-HSB Converter m D esigning and Creating the Applet Layout m D efining the Subpanels m H andling the Actions m U pdating the Result m T he Complete Source Code l U p and Coming in Java 1.1 l S ummary l Q &A Day 14 Windows, Networking, and Other Tidbits l W indows, Menus, and Dialog Boxes m T he awt Window Classes m F rames m C losing Windows m M enus m D ialog Boxes m C ursors m W indow Events m S tandalone awt Applications l N etworking in Java m C reating Links Inside Applets m O pening Web Connections m o penStream() m S ockets m C hanges to Sockets for Java 1.1 l O ther Applet Hints m T he showStatus() Method m A pplet Information m C ommunicating Between Applets l S ummary l Q &A file:///G|/ebooks/1575211831/index.htm (9 of 37) [11/06/2000 7:44:37 PM] CONTENTS Day 15 Modifiers, Access Control, and Class Design l M odifiers l C ontrolling Access to Methods and Variables m W hy Access Control Is Important m T he Four Ps of Protection m M ethod Protection and Inheritance m I nstance Variable Protection and Accessor Methods l C lass Variables and Methods l F inalizing Classes, Methods, and Variables m F inalizing Classes m F inalizing Variables m F inalizing Methods l A bstract Classes and Methods l S ummary l Q &A Day 16 Packages and Interfaces l P rogramming in the Large and Programming in the Small l W hat Are Packages? l U sing Packages m F ull Package and Class Names m T he import Command m N ame Conflicts m A Note About CLASSPATH and Where Classes Are Located l C reating Your Own Packages m P ick a Package Name m C reate the Directory Structure m U se package to Add Your Class to a Package m P ackages and Class Protection l W hat Are Interfaces? m T he Problem of Single Inheritance m A bstract Design and Concrete Implementation m I nterfaces and Classes l Im plementing and Using Interfaces file:///G|/ebooks/1575211831/index.htm (10 of 37) [11/06/2000 7:44:37 PM]

See more

The list of books you might like

Most books are stored in the elastic cloud where traffic is expensive. For this reason, we have a limit on daily download.