Wireless Programming with J2ME ™ 5,7 cod e rc ! M O lines of so + 00 on CD-R u e A line-by-line look inside professional-grade mobile applications Dreamtech Software Team Wireless Programming with J2ME™ Wireless Programming with J2ME™ Cracking the Code™ Dreamtech Software Team Best-Selling Books • Digital Downloads • e-Books • Answer Networks • e-Newsletters • Branded Web Sites • e-Learning New York, NY Æ Cleveland, OH Æ Indianapolis, IN Wireless Programming with J2ME™: Cracking the Code™ Published by Hungry Minds, Inc 909 Third Avenue New York, NY 10022 www.hungryminds.com Copyright © 2002 Hungry Minds, Inc All rights reserved No part of this book, including interior design, cover design, and icons, may be reproduced or transmitted in any form, by any means (electronic, photocopying, recording, or otherwise) without the prior written permission of the publisher Library of Congress Control Number: 2001093843 ISBN: 0-7645-4885-9 Printed in the United States of America 10 1B/QR/QS/QS/IN Distributed in the United States by Hungry Minds, Inc Distributed by CDG Books Canada Inc for Canada; by Transworld Publishers Limited in the United Kingdom; by IDG Norge Books for Norway; by IDG Sweden Books for Sweden; by IDG Books Australia Publishing Corporation Pty Ltd for Australia and New Zealand; by TransQuest Publishers Pte Ltd for Singapore, Malaysia, Thailand, Indonesia, and Hong Kong; by Gotop Information Inc for Taiwan; by ICG Muse, Inc for Japan; by Intersoft for South Africa; by Eyrolles for France; by International Thomson Publishing for Germany, Austria, and Switzerland; by Distribuidora Cuspide for Argentina; by LR International for Brazil; by Galileo Libros for Chile; by Ediciones ZETA S.C.R Ltda for Peru; by WS Computer Publishing Corporation, Inc., for the Philippines; by Contemporanea de Ediciones for Venezuela; by Express Computer Distributors for the Caribbean and West Indies; by Micronesia Media Distributor, Inc for Micronesia; by Chips Computadoras S.A de C.V for Mexico; by Editorial Norma de Panama S.A for Panama; by American Bookshops for Finland For general information on Hungry Minds’ products and services please contact our Customer Care department within the U.S at 800-762-2974, outside the U.S at 317-572-3993 or fax 317-572-4002 For sales inquiries and reseller information, including discounts, premium and bulk quantity sales, and foreign-language translations, please contact our Customer Care department at 800-434-3422, fax 317-572-4002 or write to Hungry Minds, Inc., Attn: Customer Care Department, 10475 Crosspoint Boulevard, Indianapolis, IN 46256 For information on licensing foreign or domestic rights, please contact our Sub-Rights Customer Care department at 212-8845000 For information on using Hungry Minds’ products and services in the classroom or for ordering examination copies, please contact our Educational Sales department at 800-434-2086 or fax 317-572-4005 For press review copies, author interviews, or other publicity information, please contact our Public Relations department at 317-572-3168 or fax 317-572-4168 For authorization to photocopy items for corporate, personal, or educational use, please contact Copyright Clearance Center, 222 Rosewood Drive, Danvers, MA 01923, or fax 978-750-4470 LIMIT OF LIABILITY/DISCLAIMER OF WARRANTY: THE PUBLISHER AND AUTHOR HAVE USED THEIR BEST EFFORTS IN PREPARING THIS BOOK THE PUBLISHER AND AUTHOR MAKE NO REPRESENTATIONS OR WARRANTIES WITH RESPECT TO THE ACCURACY OR COMPLETENESS OF THE CONTENTS OF THIS BOOK AND SPECIFICALLY DISCLAIM ANY IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE THERE ARE NO WARRANTIES WHICH EXTEND BEYOND THE DESCRIPTIONS CONTAINED IN THIS PARAGRAPH NO WARRANTY MAY BE CREATED OR EXTENDED BY SALES REPRESENTATIVES OR WRITTEN SALES MATERIALS THE ACCURACY AND COMPLETENESS OF THE INFORMATION PROVIDED HEREIN AND THE OPINIONS STATED HEREIN ARE NOT GUARANTEED OR WARRANTED TO PRODUCE ANY PARTICULAR RESULTS, AND THE ADVICE AND STRATEGIES CONTAINED HEREIN MAY NOT BE SUITABLE FOR EVERY INDIVIDUAL NEITHER THE PUBLISHER NOR AUTHOR SHALL BE LIABLE FOR ANY LOSS OF PROFIT OR ANY OTHER COMMERCIAL DAMAGES, INCLUDING BUT NOT LIMITED TO SPECIAL, INCIDENTAL, CONSEQUENTIAL, OR OTHER DAMAGES Trademarks: Hungry Minds, the Hungry Minds logo, and Cracking the Code are trademarks or registered trademarks of Hungry Minds, Inc in the United States and other countries and may not be used without written permission Java, Forte, NetBeans and all trademarks and logos based on Java, Forte, and NetBeans are trademarks or registered trademarks of Sun Microsystems, Inc in the U.S and other countries All other trademarks are the property of their respective owners Hungry Minds, Inc., is not associated with any product or vendor mentioned in this book is a trademark of Hungry Minds, Inc Credits Acquisitions Editor Chris Webb Project Editor Chandani Thapa Technical Editor Dr K.V.K.K Prasad Media Development Specialist Angela Denny Permissions Editor Laura Moss Media Development Manager Laura Carpenter VanWinkle Project Coordinator Nancee Reeves Cover Design Anthony Bunyan Proofreader Anne Owen Indexer Johnna VanHoose Dinse Cover Vault door image used courtesy of Brown Safe Manufacturing www.BrownSafe.com Dreamtech Software India, Inc., Team dreamtech@mantraonline.com www.dreamtechsoftware.com Dreamtech Software India, Inc., is a leading provider of corporate software solutions Based in New Delhi, India, the company is a successful pioneer of innovative solutions in e-learning technologies Dreamtech’s developers have more than 50 years of combined software-engineering experience in areas such as Java, wireless applications, XML, voice-based solutions, NET, COM/COM+ technologies, distributed computing, DirectX, Windows Media technologies, and security solutions About the Authors Lead Author Team Vikas Gupta, Co-founder and President Vikas holds a B.E in electronics, with a postgraduate diploma in sales and marketing and in publishing and printing studies Actively engaged in developing and designing new technologies in wireless applications, e-learning, and other cutting-edge areas, he is also the Managing Director of IDG Books India (P) Ltd Avnish Dass, Co-founder and CEO Avnish is a talented and seasoned programmer who has 15 years of experience in systems and application/database programming Avnish has developed security systems, antivirus programs, wireless and communication technologies, and ERP systems Yashraj Chauhan, Sr Software Developer Yashraj has an advanced diploma in software development from IBM, with more than three years of experience in Java, XML, and C++, and is pursuing his Masters in computer science Other Contributors Pankaj Kumar, Deepak Sharma, Gaurav Malhotra, Anil Kumar Singh, Bill Ray, a team of programmers of Dreamtech Software India, Inc They contributed to the development of software in this book Acknowledgments We acknowledge the contributions of the following people for their support in making this book possible: John Kilcullen for sharing his dream and providing the vision for making this project a reality Mike Violano and Joe Wikert for believing in us V.K Rajan and Priti for their immense help in coordinating various activities throughout this project To our parents and family and beloved country, India, for providing an excellent environment for nurturing and creating world-class IT talent Preface Wireless devices are new entrants in the information technology arena As wireless devices are compact and easy to handle, the focus of Information technology is rapidly shifting from PCs to PDAs, cellular phones, and pagers The market for these devices has undergone a tremendous growth over the past few years These devices are becoming increasingly sophisticated in response to the demand for using them to access the Net as well as computing devices Moreover, these devices are paving the way for new business strategies Sun Microsystems fulfilled the aspirations of the Java Community by launching J2ME (Java Micro Edition), which gave Java an edge over other programming tools in its performance on wireless devices It was first introduced at the Java One Conference in 1999 The J2ME has two “design centers.” Thus, this platform has two configurations and these are CLDC (Connected Limited Device Configuration) and CDC (Connected Device Configuration) This has to be kept in mind while talking about J2ME With an approach that is based on configurations and profiles, J2ME offers flexibility to the developer, which is of great significance for extremely diverse handheld and wireless devices This approach makes it possible to provide as much functionality as the device has the potential to support Added to this are the usual benefits of Java, such as portability across platforms, security, and the object–oriented character This is why Java is predicted to be the most preferred language for the modern computing devices It may well be said that J2ME is still in the early stages of development Two configurations have become available, but only a few of the proposed profiles are available as of now This situation is bound to change as soon as the Micro Edition platform becomes more mature Consequently, its use is also expected to increase considerably Many leading companies have started releasing Java-enabled devices This means that you can download Java applications even on your mobile phones and run them offline What this Book Covers This book is based on the unique concept of cracking the code and mastering the technology The technologies covered are J2ME (Java Micro Edition) version 1.0.2 and the applications are also tested on version 1.0.3 Beta The book is loaded with code, keeping theory to a minimum All the applications for which the source code is given have been fully tested at Dreamtech Software Research Lab The source code provided in the book is based on commercial applications developed by the software development company Dreamtech Software India Inc Each program of an application is explained in a very detailed manner to provide the reader clear insight into the implementation of the technology in a real-world situation At the end of the book, reference links are given so that the inquisitive reader can further explore the new developments that are taking place As J2ME is a new platform, not many books are available on this topic There are some books that introduce you to the theory part of J2ME This book, being a part of the Cracking the Code series, focuses more on developing applications Here, only a brief introduction to J2ME has been given, with the major part of the book devoted to writing commercial-quality code This is clear from the fact that, out of the 12 chapters in this book, six are actually projects Another two are almost fully devoted to case studies The idea here is to familiarize working professionals with the J2ME code You can also see the practical differences between the Standard Edition and the Micro Edition by going through these projects and case studies It is assumed that the reader has a reasonable command over the Java language and has some experience in programming Hungry Minds, Inc End-User License Agreement READ THIS You should carefully read these terms and conditions before opening the software packet(s) included with this book (“Book”) This is a license agreement (“Agreement”) between you and Hungry Minds, Inc (“HMI”) By opening the accompanying software packet(s), you acknowledge that you have read and accept the following terms and conditions If you not agree and not want to be bound by such terms and conditions, promptly return the Book and the unopened software packet(s) to the place you obtained them for a full refund License Grant HMI grants to you (either an individual or entity) a nonexclusive license to use one copy of the enclosed software program(s) (collectively, the “Software”) solely for your own personal and non-commercial purposes on a single computer (whether a standard computer or a workstation component of a multi-user network) The Software is in use on a computer when it is loaded into temporary memory (RAM) or installed into permanent memory (hard disk, CD-ROM, or other storage device) HMI reserves all rights not expressly granted herein Ownership HMI is the owner of all right, title, and interest, including copyright, in and to the compilation of the Software recorded on the disk(s) or CD-ROM (“Software Media”) Copyright to the individual programs recorded on the Software Media is owned by the author or other authorized copyright owner of each program Ownership of the Software and all proprietary rights relating thereto remain with HMI and its licensers Restrictions on Use and Transfer (a) You may only (i) make one copy of the Software for backup or archival purposes, or (ii) transfer the Software to a single hard disk, provided that you keep the original for backup or archival purposes You may not (i) rent or lease the Software, (ii) copy or reproduce the Software through a LAN or other network system or through any computer subscriber system or bulletin-board system, or (iii) modify, adapt, or create derivative works based on the Software (b) You may not reverse engineer, decompile, or disassemble the Software You may transfer the Software and user documentation on a permanent basis, provided that the transferee agrees to accept the terms and conditions of this Agreement and you retain no copies If the Software is an update or has been updated, any transfer must include the most recent update and all prior versions Restrictions on Use of Individual Programs You must follow the individual requirements and restrictions detailed for each individual program in the What’s on the CD-ROM appendix of this Book These limitations are also contained in the individual license agreements recorded on the Software Media These limitations may include a requirement that after using the program for a specified period of time, the user must pay a registration fee or discontinue use By opening the Software packet(s), you will be agreeing to abide by the licenses and restrictions for these individual programs that are detailed in the What’s on the CD-ROM appendix and on the Software Media None of the material on this Software Media or listed in this Book may ever be redistributed, in original or modified form, for commercial purposes Limited Warranty (a) HMI warrants that the Software and Software Media are free from defects in materials and workmanship under normal use for a period of sixty (60) days from the date of purchase of this Book If HMI receives notification within the warranty period of defects in materials or workmanship, HMI will replace the defective Software Media (b) HMI AND THE AUTHOR OF THE BOOK DISCLAIM ALL OTHER WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, WITH RESPECT TO THE SOFTWARE, THE PROGRAMS, THE SOURCE CODE CONTAINED THEREIN, AND/OR THE TECHNIQUES DESCRIBED IN THIS BOOK HMI DOES NOT WARRANT THAT THE FUNCTIONS CONTAINED IN THE SOFTWARE WILL MEET YOUR REQUIREMENTS OR THAT THE OPERATION OF THE SOFTWARE WILL BE ERROR FREE (c) This limited warranty gives you specific legal rights, and you may have other rights that vary from jurisdiction to jurisdiction Remedies (a) HMI’s entire liability and your exclusive remedy for defects in materials and workmanship shall be limited to replacement of the Software Media, which may be returned to HMI with a copy of your receipt at the following address: Software Media Fulfillment Department, Attn.: Wireless Programming with J2ME™: Cracking the Code, Hungry Minds, Inc., 10475 Crosspoint Blvd., Indianapolis, IN 46256, or call 1-800-762-2974 Please allow four to six weeks for delivery This Limited Warranty is void if failure of the Software Media has resulted from accident, abuse, or misapplication Any replacement Software Media will be warranted for the remainder of the original warranty period or thirty (30) days, whichever is longer (b) In no event shall HMI or the author be liable for any damages whatsoever (including without limitation damages for loss of business profits, business interruption, loss of business information, or any other pecuniary loss) arising from the use of or inability to use the Book or the Software, even if HMI has been advised of the possibility of such damages (c) Because some jurisdictions not allow the exclusion or limitation of liability for consequential or incidental damages, the above limitation or exclusion may not apply to you U.S Government Restricted Rights Use, duplication, or disclosure of the Software for or on behalf of the United States of America, its agencies and/or instrumentalities (the "U.S Government") is subject to restrictions as stated in paragraph (c)(1)(ii) of the Rights in Technical Data and Computer Software clause of DFARS 252.227-7013, or subparagraphs (c) (1) and (2) of the Commercial Computer Software - Restricted Rights clause at FAR 52.227-19, and in similar clauses in the NASA FAR supplement, as applicable General This Agreement constitutes the entire understanding of the parties and revokes and supersedes all prior agreements, oral or written, between them and may not be modified or amended except in a writing signed by both parties hereto that specifically refers to this Agreement This Agreement shall take precedence over any other documents that may be in conflict herewith If any one or more provisions contained in this Agreement are held by any court or tribunal to be invalid, illegal, or otherwise unenforceable, each and every other provision shall remain in full force and effect Sun Microsystems, Inc Binary Code License Agreement READ THE TERMS OF THIS AGREEMENT AND ANY PROVIDED SUPPLEMENTAL LICENSE TERMS (COLLECTIVELY "AGREEMENT") CAREFULLY BEFORE OPENING THE SOFTWARE MEDIA PACKAGE BY OPENING THE SOFTWARE MEDIA PACKAGE, YOU AGREE TO THE TERMS OF THIS AGREEMENT IF YOU ARE ACCESSING THE SOFTWARE ELECTRONICALLY, INDICATE YOUR ACCEPTANCE OF THESE TERMS BY SELECTING THE "ACCEPT" BUTTON AT THE END OF THIS AGREEMENT IF YOU DO NOT AGREE TO ALL THESE TERMS, PROMPTLY RETURN THE UNUSED SOFTWARE TO YOUR PLACE OF PURCHASE FOR A REFUND OR, IF THE SOFTWARE IS ACCESSED ELECTRONICALLY, SELECT THE "DECLINE" BUTTON AT THE END OF THIS AGREEMENT LICENSE TO USE Sun grants you a non-exclusive and non-transferable license for the internal use only of the accompanying software and documentation and any error corrections provided by Sun (collectively "Software"), by the number of users and the class of computer hardware for which the corresponding fee has been paid RESTRICTIONS Software is confidential and copyrighted Title to Software and all associated intellectual property rights is retained by Sun and/or its licensors Except as specifically authorized in any Supplemental License Terms, you may not make copies of Software, other than a single copy of Software for archival purposes Unless enforcement is prohibited by applicable law, you may not modify, decompile, or reverse engineer Software You acknowledge that Software is not designed, licensed or intended for use in the design, construction, operation or maintenance of any nuclear facility Sun disclaims any express or implied warranty of fitness for such uses No right, title or interest in or to any trademark, service mark, logo or trade name of Sun or its licensors is granted under this Agreement LIMITED WARRANTY Sun warrants to you that for a period of ninety (90) days from the date of purchase, as evidenced by a copy of the receipt, the media on which Software is furnished (if any) will be free of defects in materials and workmanship under normal use Except for the foregoing, Software is provided "AS IS" Your exclusive remedy and Sun's entire liability under this limited warranty will be at Sun's option to replace Software media or refund the fee paid for Software DISCLAIMER OF WARRANTY UNLESS SPECIFIED IN THIS AGREEMENT, ALL EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT ARE DISCLAIMED, EXCEPT TO THE EXTENT THAT THESE DISCLAIMERS ARE HELD TO BE LEGALLY INVALID LIMITATION OF LIABILITY TO THE EXTENT NOT PROHIBITED BY LAW, IN NO EVENT WILL SUN OR ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR FOR SPECIAL, INDIRECT, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE DAMAGES, HOWEVER CAUSED REGARDLESS OF THE THEORY OF LIABILITY, ARISING OUT OF OR RELATED TO THE USE OF OR INABILITY TO USE SOFTWARE, EVEN IF SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES In no event will Sun's liability to you, whether in contract, tort (including negligence), or otherwise, exceed the amount paid by you for Software under this Agreement The foregoing limitations will apply even if the above stated warranty fails of its essential purpose Termination This Agreement is effective until terminated You may terminate this Agreement at any time by destroying all copies of Software This Agreement will terminate immediately without notice from Sun if you fail to comply with any provision of this Agreement Upon Termination, you must destroy all copies of Software Export Regulations All Software and technical data delivered under this Agreement are subject to US export control laws and may be subject to export or import regulations in other countries You agree to comply strictly with all such laws and regulations and acknowledge that you have the responsibility to obtain such licenses to export, re-export, or import as may be required after delivery to you U.S Government Restricted Rights If Software is being acquired by or on behalf of the U.S Government or by a U.S Government prime contractor or subcontractor (at any tier), then the Government's rights in Software and accompanying documentation will be only as set forth in this Agreement; this is in accordance with 48 CFR 227.7201 through 227.7202-4 (for Department of Defense (DOD) acquisitions) and with 48 CFR 2.101 and 12.212 (for non-DOD acquisitions) Governing Law Any action related to this Agreement will be governed by California law and controlling U.S federal law No choice of law rules of any jurisdiction will apply 10 Severability If any provision of this Agreement is held to be unenforceable, this Agreement will remain in effect with the provision omitted, unless omission would frustrate the intent of the parties, in which case this Agreement will immediately terminate 11 Integration This Agreement is the entire agreement between you and Sun relating to its subject matter It supersedes all prior or contemporaneous oral or written communications, proposals, representations and warranties and prevails over any conflicting or additional terms of any quote, order, acknowledgment, or other communication between the parties relating to its subject matter during the term of this Agreement No modification of this Agreement will be binding, unless in writing and signed by an authorized representative of each party Java(TM) Software Development Kit (J2SDK), Standard Edition, Version 1.3 SUPPLEMENTAL LICENSE TERMS These supplemental license terms ("Supplemental Terms") add to or modify the terms of the Binary Code License Agreement (collectively, the "Agreement") Capitalized terms not defined in these Supplemental Terms shall have the same meanings ascribed to them in the Agreement These Supplemental Terms shall supersede any inconsistent or conflicting terms in the Agreement, or in any license contained within the Software Software Internal Use and Development License Grant Subject to the terms and conditions of this Agreement, including, but not limited to Section (Java(TM) Technology Restrictions) of these Supplemental Terms, Sun grants you a non-exclusive, non-transferable, limited license to reproduce internally and use internally the binary form of the Software complete and unmodified for the sole purpose of designing, developing and testing your Java applets and applications intended to run on the Java platform ("Programs") License to Distribute Software Subject to the terms and conditions of this Agreement, including, but not limited to Section (Java (TM) Technology Restrictions) of these Supplemental Terms, Sun grants you a non-exclusive, non-transferable, limited license to reproduce and distribute the Software in binary code form only, provided that (i) you distribute the Software complete and unmodified and only bundled as part of, and for the sole purpose of running, your Programs, (ii) the Programs add significant and primary functionality to the Software, (iii) you not distribute additional software intended to replace any component(s) of the Software, (iv) you not remove or alter any proprietary legends or notices contained in the Software, (v) you only distribute the Software subject to a license agreement that protects Sun's interests consistent with the terms contained in this Agreement, and (vi) you agree to defend and indemnify Sun and its licensors from and against any damages, costs, liabilities, settlement amounts and/or expenses (including attorneys' fees) incurred in connection with any claim, lawsuit or action by any third party that arises or results from the use or distribution of any and all Programs and/or Software License to Distribute Redistributables Subject to the terms and conditions of this Agreement, including but not limited to Section (Java Technology Restrictions) of these Supplemental Terms, Sun grants you a non-exclusive, non-transferable, limited license to reproduce and distribute the binary form of those files specifically identified as redistributable in the Software "README" file ("Redistributables") provided that: (i) you distribute the Redistributables complete and unmodified (unless otherwise specified in the applicable README file), and only bundled as part of Programs, (ii) you not distribute additional software intended to supersede any component(s) of the Redistributables, (iii) you not remove or alter any proprietary legends or notices contained in or on the Redistributables, (iv) you only distribute the Redistributables pursuant to a license agreement that protects Sun's interests consistent with the terms contained in the Agreement, and (v) you agree to defend and indemnify Sun and its licensors from and against any damages, costs, liabilities, settlement amounts and/or expenses (including attorneys' fees) incurred in connection with any claim, lawsuit or action by any third party that arises or results from the use or distribution of any and all Programs and/or Software Java Technology Restrictions You may not modify the Java Platform Interface ("JPI", identified as classes contained within the "java" package or any subpackages of the "java" package), by creating additional classes within the JPI or otherwise causing the addition to or modification of the classes in the JPI In the event that you create an additional class and associated API(s) which (i) extends the functionality of the Java platform, and (ii) is exposed to third party software developers for the purpose of developing additional software which invokes such additional API, you must promptly publish broadly an accurate specification for such API for free use by all developers You may not create, or authorize your licensees to create, additional classes, interfaces, or subpackages that are in any way identified as "java", "javax", "sun" or similar convention as specified by Sun in any naming convention designation Trademarks and Logos You acknowledge and agree as between you and Sun that Sun owns the SUN, SOLARIS, JAVA, JINI, FORTE, STAROFFICE, STARPORTAL and iPLANET trademarks and all SUN, SOLARIS, JAVA, JINI, FORTE, STAROFFICE, STARPORTAL and iPLANETrelated trademarks, service marks, logos and other brand designations ("Sun Marks"), and you agree to comply with the Sun Trademark and Logo Usage Requirements currently located at http://www.sun.com/policies/trademarks Any use you make of the Sun Marks inures to Sun's benefit Source Code Software may contain source code that is provided solely for reference purposes pursuant to the terms of this Agreement Source code may not be redistributed unless expressly provided for in this Agreement Termination for Infringement Either party may terminate this Agreement immediately should any Software become, or in either party's opinion be likely to become, the subject of a claim of infringement of any intellectual property right For inquiries please contact: Sun Microsystems, Inc 901 San Antonio Road, Palo Alto, California 94303 License Agreement: Forte for Java, release 2.0 Community Edition for All Platforms To obtain Forte for Java, release 2.0, Community Edition for All Platforms, you must agree to the software license below Sun Microsystems Inc., Binary Code License Agreement READ THE TERMS OF THIS AGREEMENT AND ANY PROVIDED SUPPLEMENTAL LICENSE TERMS (COLLECTIVELY "AGREEMENT") CAREFULLY BEFORE OPENING THE SOFTWARE MEDIA PACKAGE BY OPENING THE SOFTWARE MEDIA PACKAGE, YOU AGREE TO THE TERMS OF THIS AGREEMENT IF YOU ARE ACCESSING THE SOFTWARE ELECTRONICALLY, INDICATE YOUR ACCEPTANCE OF THESE TERMS BY SELECTING THE "ACCEPT" BUTTON AT THE END OF THIS AGREEMENT IF YOU DO NOT AGREE TO ALL THESE TERMS, PROMPTLY RETURN THE UNUSED SOFTWARE TO YOUR PLACE OF PURCHASE FOR A REFUND OR, IF THE SOFTWARE IS ACCESSED ELECTRONICALLY, SELECT THE "DECLINE" BUTTON AT THE END OF THIS AGREEMENT LICENSE TO USE Sun grants you a non-exclusive and non-transferable license for the internal use only of the accompanying software and documentation and any error corrections provided by Sun (collectively "Software"), by the number of users and the class of computer hardware for which the corresponding fee has been paid RESTRICTIONS Software is confidential and copyrighted Title to Software and all associated intellectual property rights is retained by Sun and/or its licensors Except as specifically authorized in any Supplemental License Terms, you may not make copies of Software, other than a single copy of Software for archival purposes Unless enforcement is prohibited by applicable law, you may not modify, decompile, or reverse engineer Software You acknowledge that Software is not designed, licensed or intended for use in the design, construction, operation or maintenance of any nuclear facility Sun disclaims any express or implied warranty of fitness for such uses No right, title or interest in or to any trademark, service mark, logo or trade name of Sun or its licensors is granted under this Agreement LIMITED WARRANTY Sun warrants to you that for a period of ninety (90) days from the date of purchase, as evidenced by a copy of the receipt, the media on which Software is furnished (if any) will be free of defects in materials and workmanship under normal use Except for the foregoing, Software is provided "AS IS" Your exclusive remedy and Sun's entire liability under this limited warranty will be at Sun's option to replace Software media or refund the fee paid for Software DISCLAIMER OF WARRANTY UNLESS SPECIFIED IN THIS AGREEMENT, ALL EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT ARE DISCLAIMED, EXCEPT TO THE EXTENT THAT THESE DISCLAIMERS ARE HELD TO BE LEGALLY INVALID LIMITATION OF LIABILITY TO THE EXTENT NOT PROHIBITED BY LAW, IN NO EVENT WILL SUN OR ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR FOR SPECIAL, INDIRECT, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE DAMAGES, HOWEVER CAUSED REGARDLESS OF THE THEORY OF LIABILITY, ARISING OUT OF OR RELATED TO THE USE OF OR INABILITY TO USE SOFTWARE, EVEN IF SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES In no event will Sun's liability to you, whether in contract, tort (including negligence), or otherwise, exceed the amount paid by you for Software under this Agreement The foregoing limitations will apply even if the above stated warranty fails of its essential purpose Termination This Agreement is effective until terminated You may terminate this Agreement at any time by destroying all copies of Software This Agreement will terminate immediately without notice from Sun if you fail to comply with any provision of this Agreement Upon Termination, you must destroy all copies of Software Export Regulations All Software and technical data delivered under this Agreement are subject to US export control laws and may be subject to export or import regulations in other countries You agree to comply strictly with all such laws and regulations and acknowledge that you have the responsibility to obtain such licenses to export, re-export, or import as may be required after delivery to you U.S Government Restricted Rights If Software is being acquired by or on behalf of the U.S Government or by a U.S Government prime contractor or subcontractor (at any tier), then the Government's rights in Software and accompanying documentation will be only as set forth in this Agreement; this is in accordance with 48 CFR 227.7201 through 227.7202-4 (for Department of Defense (DOD) acquisitions) and with 48 CFR 2.101 and 12.212 (for non-DOD acquisitions) Governing Law Any action related to this Agreement will be governed by California law and controlling U.S federal law No choice of law rules of any jurisdiction will apply 10 Severability If any provision of this Agreement is held to be unenforceable, this Agreement will remain in effect with the provision omitted, unless omission would frustrate the intent of the parties, in which case this Agreement will immediately terminate 11 Integration This Agreement is the entire agreement between you and Sun relating to its subject matter It supersedes all prior or contemporaneous oral or written communications, proposals, representations and warranties and prevails over any conflicting or additional terms of any quote, order, acknowledgment, or other communication between the parties relating to its subject matter during the term of this Agreement No modification of this Agreement will be binding, unless in writing and signed by an authorized representative of each party JAVA™ DEVELOPMENT TOOLS FORTE™ FOR JAVA™, RELEASE 2.0, COMMUNITY EDITION SUPPLEMENTAL LICENSE TERMS These supplemental license terms ("Supplemental Terms") add to or modify the terms of the Binary Code License Agreement (collectively, the "Agreement") Capitalized terms not defined in these Supplemental Terms shall have the same meanings ascribed to them in the Agreement These Supplemental Terms shall supersede any inconsistent or conflicting terms in the Agreement, or in any license contained within the Software Software Internal Use and Development License Grant Subject to the terms and conditions of this Agreement, including, but not limited to Section (Java(TM) Technology Restrictions) of these Supplemental Terms, Sun grants you a non-exclusive, non-transferable, limited license to reproduce internally and use internally the binary form of the Software complete and unmodified for the sole purpose of designing, developing and testing your [Java applets and] applications intended to run on the Java platform ("Programs") License to Distribute Redistributables In addition to the license granted in Section (Redistributables Internal Use and Development License Grant) of these Supplemental Terms, subject to the terms and conditions of this Agreement, including, but not limited to Section (Java Technology Restrictions) of these Supplemental Terms, Sun grants you a non-exclusive, nontransferable, limited license to reproduce and distribute those files specifically identified as redistributable in the Software “README” file (“Redistributables”) provided that: (i) you distribute the Redistributables complete and unmodified (unless otherwise specified in the applicable README file), and only bundled as part of your Programs, (ii) you not distribute additional software intended to supercede any component(s) of the Redistributables, (iii) you not remove or alter any proprietary legends or notices contained in or on the Redistributables, (iv) for a particular version of the Java platform, any executable output generated by a compiler that is contained in the Software must (a) only be compiled from source code that conforms to the corresponding version of the OEM Java Language Specification; (b) be in the class file format defined by the corresponding version of the OEM Java Virtual Machine Specification; and (c) execute properly on a reference runtime, as specified by Sun, associated with such version of the Java platform, (v) you only distribute the Redistributables pursuant to a license agreement that protects Sun's interests consistent with the terms contained in the Agreement, and (vi) you agree to defend and indemnify Sun and its licensors from and against any damages, costs, liabilities, settlement amounts and/or expenses (including attorneys' fees) incurred in connection with any claim, lawsuit or action by any third party that arises or results from the use or distribution of any and all Programs and/or Software Java Technology Restrictions You may not modify the Java Platform Interface ("JPI", identified as classes contained within the "java" package or any subpackages of the "java" package), by creating additional classes within the JPI or otherwise causing the addition to or modification of the classes in the JPI In the event that you create an additional class and associated API(s) which (i) extends the functionality of the Java platform, and (ii) is exposed to third party software developers for the purpose of developing additional software which invokes such additional API, you must promptly publish broadly an accurate specification for such API for free use by all developers You may not create, or authorize your licensees to create, additional classes, interfaces, or subpackages that are in any way identified as "java", "javax", "sun" or similar convention as specified by Sun in any naming convention designation Java Runtime Availability Refer to the appropriate version of the Java Runtime Environment binary code license (currently located at http://www.java.sun.com/jdk/index.html) for the availability of runtime code which may be distributed with Java applets and applications Trademarks and Logos You acknowledge and agree as between you and Sun that Sun owns the SUN, SOLARIS, JAVA, JINI, FORTE, STAROFFICE, STARPORTAL and iPLANET trademarks and all SUN, SOLARIS, JAVA, JINI, FORTE, STAROFFICE, STARPORTAL and iPLANETrelated trademarks, service marks, logos and other brand designations ("Sun Marks"), and you agree to comply with the Sun Trademark and Logo Usage Requirements currently located at http://www.sun.com/policies/trademarks Any use you make of the Sun Marks inures to Sun's benefit Source Code Software may contain source code that is provided solely for reference purposes pursuant to the terms of this Agreement Source code may not be redistributed unless expressly provided for in this Agreement Termination for Infringement Either party may terminate this Agreement immediately should any Software become, or in either party's opinion be likely to become, the subject of a claim of infringement of any intellectual property right For inquiries please contact: Sun Microsystems, Inc 901 San Antonio Road, Palo Alto, California 94303 Wireless Programming with J2ME Dreamtech Software India, Inc., is a leading provider of corporate software solutions Based in New Delhi, India, the Dreamtech software team has more than 50 years of combined software engineering experience ™ Create Tomorrow’s Mobile Applications Today In this unique guide, a crack team of software engineers delivers the programming solutions and source code you need to jump-start a wide range of mobile application projects with Java Micro Edition Using flow charts and line-by-line analysis of six professional-quality applications, they show you how to solve for typical J2ME programming challenges — and create your own applications using CLDC, MIDP, XML, and other cutting-edge technologies Take an In-Depth Look at Professional-Grade Mobile Applications • Online testing engine for Palm OS devices • Online ordering system for cell phones and pagers CD-ROM Includes: • MP3 player for Pocket PCs professional-quality applications and topical case studies, complete with over 5,700 lines of source code • Peer-to-peer search application for Palm OS devices Java Software Development Kit Standard Edition version 1.3 for Windows Java Platform, Micro Edition, Wireless Toolkit 1.0.1 Forte for Java, release 2.0, Community Edition for All Platforms • Mobile Web services (weather, movie ticket ordering, news) for cell phones • Target practice game for Palm OS devices • Plus CLDC implementation, MIDP-MIDlet implementation, and XML parsing case studies and guidance on converting existing applications into J2ME All software tested at the Dreamtech Software Research Lab Tomcat JavaServer Pages Implementation Server and kXML ISBN 0-7645-4885-9 Reader Level Intermediate to Advanced Shelving Category Programming *85 -BA IAa $49.99 US $74.99 CANADA £39.99 UK incl VAT www.hungryminds.com ,!7IA7G4-fei fh!:p;o;t;T;T .. .Wireless Programming with J2ME Wireless Programming with J2ME Cracking the Code Dreamtech Software Team Best-Selling Books • Digital... professionals with the J2ME code You can also see the practical differences between the Standard Edition and the Micro Edition by going through these projects and case studies It is assumed that the reader... APIs fully The fifth chapter is on J2ME and contains what is relevant to programming with J2ME It deals with XML parsing XML parsing is used in almost all the projects in the book After the introduction,