Foreword to the First Edition by James Gosling xiiiForeword to the First Edition by Bill Shannon xv
Preface xvii
About the Authors xxv
Acknowledgments for the Second Edition xxvii
Acknowledgments for the First Edition xxix
Chapter 1: Download, Installation, and First Project 1
Downloading the IDE 2
Installing the IDE 3
Setting a Proxy 3
First NetBeans IDE Project 4 Chapter 2: NetBeans IDE Fundamentals 9
Creating a Project 10
Configuring the Classpath 12
Creating a Subproject 13
Creating and Editing Files 15
Setting Up and Modifying Java Packages 17
Compiling and Building 18
Viewing Project Metadata and Build Results 18
Navigating to the Source of Compilation Errors 19
Running 20
Creating and Running Tests 20
Debugging the Application 21
Integrating Version Control Commands 22
Managing IDE Windows 23 Chapter 3: IDE Project Fundamentals 25
Introduction to IDE Projects 26
Choosing the Right Project Template 28
Creating a Project from Scratch 29
Importing a Project Developed in a Different Environment 33
Navigating Your Projects 37
Working with Files Not in the Project 41
Creating Packages and Files in the Project 42
Configuring the Project's Classpath 44
Changing the Version of the JDK Your Project Is Based On 45
Changing the Target JDK for a Standard Project 46
Referencing JDK Documentation (Javadoc) from the Project 46
Adding Folders and JAR Files to the Classpath 47
Making External Sources and Javadoc Available in the IDE 47
Structuring Your Projects 48
Displaying and Hiding Projects 50
Compiling a Project 50
Running a Project in the IDE 55
Deploying a Java Project Outside of the IDE 57
Building a Project from Outside of the IDE 59
Customizing the IDE-Generated Build Script 60
Running a Specific Ant Target from the IDE 64
Completing Ant Expressions 64
Making a Menu Item or Shortcut for a Specific Ant Target 65 Chapter 4: Versioning Your Projects 69
Setting up CVS in NetBeans IDE 70
Checking Out Sources from a CVS Repository 71
Putting a Project into CVS 74
Keeping Track of Changes 76
Updating Files 80
Committing Changes 80
Ignoring Files in CVS Operations 81
Adding and Removing Files from a Repository 82
Working with Branches 82
Working with Patches 85
Working with Versioning Histories 87
Working with Other Version Control Systems 89 Chapter 5: Editing and Refactoring Code 91
Opening the Source Editor 92
Managing Automatic Insertion of Closing Characters 93
Displaying Line Numbers 94
Generating Code Snippets without Leaving the Keyboard 94
Using Code Completion 96
Inserting Snippets from Code Templates 100
Using Editor Hints to Generate Missing Code 108
Matching Other Words in a File 109
Generating Methods to Implement and Override 110
Generating JavaBeans Component Code 111
Creating and Using Macros 112
Creating and Customizing File Templates 113
Handling Imports 115
Displaying Javadoc Documentation While Editing 116
Formatting Code 116
Text Selection Shortcuts 120
Navigating within the Current Java File 120
Navigating from the Source Editor 124
Searching and Replacing 126
Deleting Code Safely 131
Changing a Method's Signature 135
Encapsulating a Field 136
Moving a Class to a Different Package 138
Moving Class Members to Other Classes 139
Creating a Method from Existing Statements 141
Creating an Interface from Existing Methods 142
Extracting a Superclass to Consolidate Common Methods 143
Changing References to Use a Supertype 145
Unnesting Classes 146
Tracking Notes to Yourself in Your Code 148
Comparing Differences Between Two Files 150
Splitting the Source Editor 151
Maximizing Space for the Source Editor 151
Changing Source Editor Keyboard Shortcuts 152 Chapter 6: Building Java Graphical User Interfaces 153
Using Different Layout Managers 156
Placing and Aligning a Component in a Form 157
Setting Component Size and Resizability 159
Setting Component Alignment 160
Specifying Component Behavior and Appearance 161
Generating Event Listening and Handling Methods 162
Customizing Generated Code 165
Previewing a Form 166
Using Custom Beans in the Form Editor 166
Deploying GUI Applications Developed with Matisse 167 Chapter 7: Debugging Java Applications 169
Starting a Debugging Session 171
Attaching the Debugger to a Running Application 175
Starting the Debugger Outside of the Project's Main Class 177
Stepping through Code 177
Setting Breakpoints 181
Managing Breakpoints 185
Customizing Breakpoint Behavior 186
Monitoring Variables and Expressions 189
Backing up from a Method to Its Call 192
Monitoring and Controlling Execution of Threads 192
Fixing Code During a Debugging Session 194
Viewing Multiple Debugger Windows Simultaneously 195 Chapter 8: Developing Web Applications 197
Representation of Web Applications in the IDE 199
Adding Files and Libraries to Your Web Application 203
Editing and Refactoring Web Application Files 208
Deploying a Web Application 214
Testing and Debugging Your Web Application 217
Creating and Deploying Applets 219
Changing the IDE's Default Web Browser 223
Monitoring HTTP Transactions 224 Chapter 9: Creating Web Applications on the JSF and Struts Frameworks 233
JSF Overview 234
Struts Overview 240 Chapter 10: Introduction to Java EE Development in NetBeans IDE 251
Configuring the IDE for Java EE Development 252
Java EE Server Support 255
Getting the Most from the Java BluePrints Solutions Catalog 257 Chapter 11: Extending Web Applications with Business Logic: Introducing Enterprise Beans 267
EJB Project Template Wizards 269
Adding Enterprise Beans, Files, and Libraries to Your EJB Module 272
Adding Business Logic to an Enterprise Bean 275
Adding a Simple Business Method 276
Enterprise Bean Deployment Descriptors 280 Chapter 12: Extending Java EE Applications with Web Services 283
Consuming Existing Web Services 284
IDE and Server Proxy Settings 291
Creating a WSDL File 292
Implementing a Web Service in a Web Application 292
Implementing Web Services within an EJB Module 300
Testing Web Services 301
Adding Message Handlers to a Web Service 304 Chapter 13: Developing Full-Scale Java EE Applications 311
Creating Entity Beans with the Top-Down Approach 313
Creating Entity Beans with the Bottom-Up Approach 321
Assembling Enterprise Applications 324
Importing Existing Enterprise Applications 328
Consuming Java Enterprise Resources 333
Java EE Platform and Security Management 341
Understanding the Java EE Application Server Runtime Environment 347
Ensuring Java EE Compliance 355
Refactoring Enterprise Beans 357
Database Support and Derby Integration 359 Chapter 14: Developing Java ME Mobile Applications 363
Downloading and Installing the Mobility Pack 364
Mobility Primer 364
Configuration vs. Configuration 366
Setting up Mobility Projects 366
Creating a Project from Scratch 366
Importing a Project 367
Physical Structure of Mobile Projects 369
Using Mobility File Templates 370
Configuring the Project's Classpath 372
Debugging Your Project 376
Configuring Your Project for Different Devices 377
Setting the Active Configuration for Your Project 379
Reusing Project Settings and Configurations 380
Structuring Project Dependencies 382
Managing the Distribution JAR File Content 383
Handling Project Resources for Different Configurations 384
Writing Code Specific to a List of Configurations 385
Using the Preprocessor 387
Using Configuration Abilities 397
Creating and Associating an Ability with a Configuration 398
Localizing Applications 400
Using the MIDP Visual Designer 402
Understanding the Flow Designer 405
Understanding the Screen Designer 413
Deploying Your Application Automatically 414
Incrementing the Application's MIDlet-Version Automatically 417
Using Ant in Mobility Projects 417
Using Headless Builds 421
Using the Wireless Connection Tools 422
Finding More Information 426 Chapter 15: Profiling Java Applications 427
Supported Platforms 428
Downloading and Installing the NetBeans Profiler 429
Starting a Profiling Session 429
The Profiler Control Panel 432
Monitoring an Application 435
Analyzing Performance 437
Analyzing Code Fragment Performance 442
Analyzing Memory Usage 443
Attaching the Profiler to a JVM 447 Chapter 16: Integrating Existing Ant Scripts with the IDE 449
Creating a Free-Form Project 451
Mapping a Target to an IDE Command 453
Setting up the Debug Project Command for a General Java Application 455
Setting up the Debug Project Command for a Web Application 457
Setting up Commands for Selected Files 462
Setting up the Compile File Command 463
Setting up the Run File Command 466
Setting up the Debug File Command 468
Setting up the Debugger's Apply Code Changes Command 470
Setting up the Profile Project Command for a General Java Application 471
Changing the Target JDK for a Free-Form Project 472
Making a Custom Menu Item for a Target 473
Debugging Ant Scripts 473 Chapter 17: Developing NetBeans Plug-in Modules 477
Plug-in Modules 478
Rich-Client Applications 478
Extending NetBeans IDE with Plug-in Modules 480
Setting up a Plug-in Module 481
Using the NetBeans APIs 486
Registering the Plug-in Module 496
Adding a License to a Plug-in Module 497
Building and Trying Out a Plug-in Module 499
Packaging and Distributing a Plug-in Module 500
Packaging and Distributing a Rich-Client Application 502
Finding Additional Information 504 Chapter 18: Using NetBeans Developer Collaboration Tools 507
Getting the NetBeans Developer Collaboration Tools 508
Configuring NetBeans IDE for Developer Collaboration 509
Creating a Collaboration Account 510
Managing Collaboration Accounts 514
Logging into a Collaboration Server 518
Collaborating and Interacting with Developers 519 Appendix A: Importing an Eclipse Project into NetBeans IDE 527
Getting the Eclipse Project Importer 528
Choosing Between Importing with and Importing without Project Dependencies 529
Importing an Eclipse Project and Preserving Project Dependencies 529
Importing an Eclipse Project and Ignoring Project Dependencies 532
Handling Eclipse Project Discrepancies 534
Handling Eclipse Project Reference Problems 534 Appendix B: Importing a JBuilder Project into NetBeans IDE 537
Getting the JBuilder Project Importer 538
Importing a JBuilder 2005 Project 538
Project Import Warnings 539
Running the Imported Project 540 Index 541