Building Applications with IBM WebSphere Studio and JavaBeans: A Guided Tour ISBN:1931182140 by Colette Burrus and Stephanie Parkin MC Press © 2003 (444 pages) This book is the definitive guided tour through learning how to develop applications using IBM WebSphere Studio and JavaBeans, with a clear and understandable explanation of XML and database programming CD Content Table of Contents Building Applications with WebSphere Studio and JavaBeans—A Guided Tour Introduction About This Book Chapter 1 - Creating Your First Applet Extending Your First Chapter 2 Applet Creating Your First Chapter 3 Application Creating a FileChapter 4 - Manipulation Subcomponent Chapter 5 - Using Layout Managers Chapter 6 - Using Swing Components When Something Goes Chapter 7 Wrong—Debugging Advanced Applet Chapter 8 Development Chapter 9 - Working With Databases Chapter 10 - Working With XML Data Chapter 11 - Using XML Schemas Appendix A - Installing the Software Appendix B - Java Basics Index List of Figures List of Tables List of Sidebars CD Content Back Cover Don’t be overwhelmed with programming gobbledygook This book is the definitive guided tour through learning how to develop applications using IBM WebSphere Studio and JavaBeans, with a clear and understandable explanation of XML and database programming In the simplest way possible, you’ll learn reusable concepts, not just product Along the way, you’ll learn the basics of how to develop Java applets and applications, as well as more advanced topics, such as using relational databases and eXtensible Markup Language (XML) documents to store your application data By the end of the tour, you’ll be able to use IBM WebSphere Studio to build your own applications, and you’ll understand why JavaBeans are so useful for application programming This book assumes you have some basic knowledge of the Java programming language, but you certainly don’t need to be an expert to follow the tour You do need to be running one of the Windows operating systems, and as long as you’re comfortable with Windows, the Internet, and Web browsers, you’re ready to learn Java Experts will benefit from the tour, because it will teach you many of the IBM WebSphere Studio features that will let you build your Java applications easier and faster This book uses the “show and tell” approach If you flip through the pages, you’ll notice that they are loaded with pictures showing you how your applications should look at each step along the way When you complete this book, you will know how to: Use IBM WebSphere Studio and JavaBeans to easily create applications Code in eXtensible Markup Language (XML) Use databases with your applications Build applications more efficiently and productively Create applets Use Swing components and layout managers About the Authors Colette Vurrus recently retired from IBM, after spending more than 20 years in a variety of programming and project management jobs Her most recent assignment was project manager for the IBM alphaBeans project, working with the “Beans Around the World” team She also coauthored a previous book, VisualAge for Java for Non-Programmers, and a corresponding Web-based tutorial series Stephanie Parkin is an information architect for the IBM WebSphere Developer Domain Web site In her career at IBM she has been managing editor of the WebSphere and VisualAge Developer Domains, and has created and edited documents for various programming languages, including VisualAge for Basic She also was the Editor-in-Chief of the WebSphere Developer Technical Journal Stephanie also coauthored the previous book and tutorial series, and has published an article on Designing Beans in Java Developer’s Journal Building Applications with WebSphere Studio and JavaBeans—A Guided Tour Stephanie Parkin Colette Burrus IBM Press™ Published by IBM Press™ IBM Associate Publisher: Tara B Woodman, IBM Corporation IBM Press Alliance Publisher: David M Uptmor, MC Press For information on translations and book distribution outside the United States or to arrange bulk-purchase discounts for sales promotions or premiums please contact: MC Press Corporate Offices: 125 N Woodland Trail Lewisville, TX 75077 Sales and Customer Service: P.O Box 4300 Big Sandy, TX 75755-4300 First edition First printing: May 2003 1-931182-14-0 All rights reserved No part of this publication may be reproduced in any form without prior permission in writing of the copyright owner Copyright © 2003 International Business Machines Corporation Portions © 2003 by MC Press Every attempt has been made to provide correct information in this book However, the publisher, the editors, and the authors do not guarantee the accuracy of the book and do not assume responsibility for information included in or omitted from it The following are trademarks of International Business Machines Corporation in the United States, other countries, or both: IBM, the IBM logo, IBM Press, the IBM Press logo The e-business logo nad WebSphere logo are trademarks of IBM and used under license List of Trademarks: Adobe, DB2, DB2 Universal Database, IBM, Java, JDBC, Microsoft, Netscape, Sun, VisualAge, WebSphere, Windows, Windows NT Dedication For Steve, forever.—Colette Burrus For Sean, Calvin, and Sam.—Steph Parkin Acknowledgments As with our previous book, we first need to thank our colleagues at Software House Technology (now Exigen Latvia), in Riga, Latvia Tatjana Lukovnikova, Pavels Nikolajevs, Juris Krikis, and Tatjana Apine wrote the initial VisualAge for Java tutorials upon which this book is based Also, a huge thanks to Dave Pullin for the initial idea and the determination to get this knowledge in the hands of users And thanks to the scores of developers who worked on the "JavaBeans Around the World" Project Their beans provided the core technology that let us build the applications in this book Second, we'd like to thank our technical reviewers at IBM: Joe Winchester reviewed the entire book and gave excellent feedback, and Jim Mann also provided valuable comments Thanks to Ernest Mah and Dr Gili Mendel for answering product questions and to Lynn Jonas, Mark Edwards, John Botsford, Nak Paik, and Jeff Turnham for getting us early access to product drivers Thanks to Merrikay Lee for her editing expertise Finally, a warm thanks to Tara Woodman for a very smooth book-publishing process and equipment to help develop the book Introduction This book takes you on a guided tour to building applications with the WebSphere Studio Visual Editor for Java and JavaBeans Along the way, you'll learn the basics of how to develop Java applets and applications, as well as more advanced topics such as using relational databases and eXtensible Markup Language (XML) documents to store your application data By the end of the tour you'll be able to use WebSphere Studio to build your own applications and you'll understand why JavaBeans are so useful for application programming If you're new to Java and Java development environments, that's OK This book assumes you have some basic knowledge of the Java programming language, but you certainly don't need to be an expert to follow the tour You do need to be running one of the Windows operating systems, and as long as you're comfortable with Windows, the Internet, and Web browsers, you're ready to learn Java If you are already familiar with Java and Java development environments, that's OK, too You'll still benefit from going through the tour, because it will teach you many of the WebSphere Studio features that will let you build your Java applications easier and faster This book uses the "show and tell" approach If you flip through the pages, you'll notice that they are loaded with pictures showing how your applications should look at each step along the way In addition, we've included two CDs that contain all the tools you'll need to follow along with the lessons Why Java? Java is considered the language of the Internet It combines two important advances in computer science: object orientation and platform independence Object orientation means that the programming language models real-world components and behavior You organize your programs into objects with certain properties and define the activities that the objects can perform Complex behavior is hidden in the implementation of the object, letting you just connect the object to other objects Secondly, Java is platform-independent, which means that you can create programs on a Windows machine and be confident that the program will work in any environment that Java runs in In the past few years the use of Java has exploded It has expanded well beyond its original main purpose of providing dynamic Web pages, to a full server-side programming language It enables the development of complex Internet functionality, such as querying legacy databases, enabling business-to-business Web commerce, and providing interactive Web communications Because it's based on open standards, all Java programs use a common API This means that you can reuse other Java components and easily snap them into your programs Visual Editor for Java WebSphere Studio Site Developer 5.0 is the development tool that you'll use during the guided tour As you'll see, WebSphere Studio is a fullfunction integrated development environment that contains everything you need to create, test, and maintain your Java applications The Visual Editor for Java, new with WebSphere Studio 5.0, makes development of Java applications even easier and faster—you just drag and drop the elements you want to use for your application and customize them to set the properties you want, and it generates the underlying code for you Appendix B: Java Basics Figure B.1: Cars are a class of objects Figure B.2: A single class can have multiple constructors Figure B.3: Running the program in WebSphere Studio Figure B.4: Source code for a simple Java program List of Tables Chapter 5: Using Layout Managers Table 5-1: Properties for additional SettingPanel beans Chapter 8: Advanced Applet Development Table 8-1: NavigationPanel applet parameters Chapter 9: Working With Databases Table 9-1: Column data List of Sidebars Chapter 1: Creating Your First Applet What's a JAR file? Java Build Paths What's a class? VisualAge for Java users What's in a name? What's an interface? What's an inner class? Saving your work Chapter 2: Extending Your First Applet Working with different data types Chapter 3: Creating Your First Application What's an application? Chapter 4: Creating a File-Manipulation Subcomponent GridBagLayout What's a Vector? Chapter 5: Using Layout Managers What size do you prefer? When to use radio buttons Chapter 7: When Something Goes Wrong— Debugging What's a thread? Chapter 8: Advanced Applet Development Differences between browsers HTML target parameter Browser level Chapter 9: Working With Databases The java.util.Date class CD Content Following are select files from this book's Companion CD-ROM These files are copyright protected by the publisher, author, and/or other third parties Unauthorized use, reproduction, or distribution is strictly prohibited Click on the link(s) below to download the files to your computer: File Description Building Applications with IBM WebSphere All CD Content Studio and JavaBeans Size 1,637,086 Chapter 1: Creating Your First Applet 330,931 Chapter 2: Extending Your First Applet 339,826 Chapter 3: Creating Your First Application 136,549 Chapter 4: Creating a File-Manipulation Subcomponent 22,203 Chapter 5: Using Layout Managers 31,366 Chapter 6: Using Swing Components 345,654 Chapter 7: When Something Goes Wrong—Debugging 109,093 Chapter 8: Advanced Applet Development 299,493 Chapter 9: Working With Databases Chapter 10: Working With XML Data Chapter 11: Using XML Schemas 8,182 5,947 11,129 ... This book takes you on a guided tour to building applications with the WebSphere Studio Visual Editor for Java and JavaBeans Along the way, you'll learn the basics of how to develop Java applets and applications, as well as more advanced topics such as using relational databases and. .. As you'll see, WebSphere Studio is a fullfunction integrated development environment that contains everything you need to create, test, and maintain your Java applications The Visual Editor for Java, new with WebSphere Studio 5.0, makes development of Java applications even easier and faster—you just drag and drop the... Working with databases: Teaches the basics of storing your data in a relational database, including manipulating that data from your visual programs You'll create a Friends database that lets you store information on your friends, including digital photos