Book IconJAVABEANS DEVELOPER'S RESOURCE



Introduction

This book was designed from the ground up for people who have a strong desire to learn all about Java and JavaBeans, in particular. It is not a marketing brochure and it is not a gee-whiz propeller-head technical tome. It is an honest account and appraisal of JavaBeans technology, both the good and the bad. JavaBeans is a wonderful component architecture embraced by, of course, Sun Microsystems and its loyal legion of followers, as well as Microsoft and the other 85 percent of the computing world. For that reason alone, JavaBeans is the single most important API for Java.

This book takes a very hands-on approach to teaching JavaBeans technology. There are several code examples, and all of them build on one another from chapter to chapter. The book is designed to be very accessible; you won't see language intended to be understood only by PhDs from Berkeley. Rather, the book attempts to teach you the basics and advanced concepts of JavaBeans with easy to understand examples and code fragments. It is neither insulting nor impossible. All that's required is a firm grasp of the fundamentals of object-oriented programming and Java in particular.

What You'll Need

The CD included with this book supports both the Windows 95/Windows NT platform as well as the Solaris platform. While Java's write once-run everywhere mantra dictates that the code examples included with the book should run on any Java Virtual Machine that supports Java 1.1.1, any seasoned Java programmer will quickly note that write once-run everywhere is a myth along the lines of Paul Bunyan. Nevertheless, the code has been tested on only Win32 and Solaris platforms. In addition, included is the Java Developer's Kit 1.1.1 for Win32 and Solaris only. Time considerations hampered the ability to include a Macintosh VM.

How to Read This Book

This book is divided into four parts, and further divided by chapter from there. Because it is highly unusual for a technical book to be read cover-to-cover, the text contains several things that make life easier for those that like to jump around. You will find, interspersed throughout the text, several icons that are designed to grab your attention and point out important features. The API Tip (an example of which can be found later in this introduction), will allow you to search for specific methods contained within a JavaBeans API. The Design Pattern Tip lets you in on some suggested naming conventions for JavaBeans objects. Ideally, of course, the book should be read in order of chapter, but sometimes that is simply not realistic. The icons are there to help you.

Parts Is Parts

Part One deals with Java and Component Models and provides the foundation for much of your work in JavaBeans throughout this book. In Chapter 1, you will get an understanding of the basic language constructs, including Objects, Serialization, Reflection, and more. In addition, Chapter 2 discusses what components are all about, and how people have been using them in the past and where Java will take them in the future.

Part Two addresses the nuts and bolts of JavaBeans. Here, you'll see how to take three different Beans, add events, properties, introspection, and persistence to them, and connect them together. Chapter 3 covers the JavaBeans Event Model, while Chapter 4 talks about JavaBeans and Properties. In Chapter 5 you'll get the low down on JavaBeans and Introspection, and Chapter 6 closes out with Persistence and Packaging.

Part Three moves you beyond the daily rigors of coding and covers several Advanced Beans Concepts. The GUI Builder is the single most important aspect of Bean development, and Chapter 7 shows you how to use a GUI Builder to assemble disparate Beans and build an application or applet. Chapter 8 talks about several Bean-related GUI issues that can make your applications prettier and more component-ized. Chapter 9 delves into Bean integration with Microsoft's ActiveX component model and Netscape's JavaScript programming language. Chapter 10 introduces Bean networking by talking about Java Remote Method Invocation (RMI) and Java Interface Definition Language (IDL), the Java binding to industry-standard CORBA objects.

Part Four is a lovingly fluffy marketing brochure that was slipped into an otherwise highly technical book. Chapter 11 discusses in marketing-level detail what Beans can accomplish in the real world and what other companies, like Corel and Lotus, are doing with Beans. This had to be thrown in to make Product Marketing Managers happy. Besides, you do want to know why you should do Beans, right?

Note: Throughout this book JavaBeans may be referred to as Beans or Beans components. The technical, trademarked name is JavaBeans. But, for the general flow and beauty of the text, from time to time the official name may be shortened.

Appendixes

There are also three Appendixes that will show you how to do some of the more mundane things with Bean development. Appendix A is a Quick Start Guide that maps out where advanced Java and Beans developers should go for information. Appendix B is a quick guide to the features and bugs of the Bean Development Kit's Bean Box. Finally, Appendix C will show you how to install and run the applications on the CD-ROM included with this book.

CD-ROM

The CD provided with this book contains some very useful items. The first of these items is the latest and greatest version (1.1.1) of the Java Developer's Kit (JDK). The JDK contains all of the Beans classes and objects that you need to build JavaBeans applications. However, a second component, the Beans Developer's Kit (BDK), is also included. The BDK contains a sample container (discussed in Appendix B) and several example Beans. In addition, the major source code from every chapter is also included. The RainbowButton Bean that is used as an example throughout the book is here in all its glory and excitement. In addition, you can play with examples of reflection, serialization, and more.

Conventions

Throughout this book, you will see the use of various typographic conventions, which are outlined here.

Icons

Icons represent called-out material that is of significance and that you, the reader, should be alerted to. These include:

  • A Warning icon is used to point out a bug, mistake, or common error made by Beans developers.

  • A Note is a brief discussion about something that might be useful to you along the way.

  • A Tip is a helpful bit of advice for developers. It may range from something as mundane as how to compile an object, or to something as complex as how to properly multiplex an event.

  • An API Tip is a special kind of Tip that points out a specific use of a method in one of the various Beans APIs that are discussed throughout this book. It will describe the method itself, the parameters to the method, any return types for the method, as well as any exceptions that may be thrown by the method.

  • A Design Pattern Tip is a suggested way of naming a function. This kind of tip describes that design pattern in detail and shows you how to properly construct a function using it.


  • (Because of the large number of times the API Tip and Design Pattern Tip are used in succession in the book, their discussions will appear in normal text with a n at the end to(Because of the large number of times the API Tip and Design Pattern Tip are used in succession in the book, their discussions will appear in normal text with a n at the end to denote their conclusion.)

    Code

    Code samples, code extracts within text, and other specific items (like methods, arrays, objects, or classes) are denoted by using the Courier font, like this: public class Jenny { } Any later additions to the code will be represented in bold face type, like this: public class Jenny {   String loves = "Prashant"; } Note: I never quite understood what a program listing was, and as you will see, I keep showing fragments of code, followed by additions to the fragments as I go along. You will also notice that whenever I add a pile of code to an existing pile of code, the new code is bolded. I have always appreciated it when authors don't skimp on listings and show as much as possible, in as coherent a manner as possible.

    Sidebars

    At the end of Chapters 1-4, 7, 8, and 11, a sidebar is used for some light-hearted relief. Each one will supply you with some background information on various Beans. Not computer Beans, but coffee Beans. After all, for the truly geeky among us, a good cup of Java is as important as a good line of Java.

    Closing Thoughts

    Finally, I would like to thank you for buying this book. I wrote this book because I believe in Java. I do not apologize for my enthusiasm, rather I celebrate it. If work isn't fun, it just isn't worth doing. Java makes Computer Science fun, and JavaBeans makes Java extremely useful. Writing on JavaBeans was easy because of folks like Graham Hamilton and Larry Cable whose genius produced such a wonderfully practical toy to play with. I know there might be some errors here and there throughout this book. For that I apologize. Such is the nature of the technical writing business. I welcome your feedback. Please feel free to contact me at heath@mediacity.com. You can also visit my web site at http://www.mediacity.com/~heath. Writing a book is a labor of love, and there's no doubt I had fun through the whole thing. It's made possible by folks like you who take the time to praise and criticize when necessary.

    Thanks!




    ISBN: 0-13-727751-2
    UPC $49.95 USA $69.95 Canada
    [Cover][About the book][Table of Contents][Summation][Ordering Info]

    Home



    © Prentice-Hall, Inc.
    A Simon & Schuster Company
    Upper Saddle River, New Jersey 07458

    Legal Statement