69 Codecompletion...69 Using and Not Using NetBeans Source Editor Code Completion .... 230 Mirrors...230 SunSites...230 Open source projects coded using NetBeans which include NetBeans d
Trang 1NetBeans: the Definitive Guide
Trang 2Table of Contents
NetBeans in a Nutshell
1.Introduction
Is NetBeans For You? 1
Is This Book For You? 2
NetBeans and Java 2
What are Java Beans? 2
The Core Concept of NetBeans 3
NetBeans as the "Visual JDK" 4
All The Usual Features 4
NetBeans as a tools platform 5
NetBeans as an open source community 6
A Steady Stream of Creativity 6
Don't Be Cross That This Book Is Cross-Platform 6
Contents of the Accompanying Sources 7
Licensing of the Code Examples in this Book 7
Writing Conventions in this Book 7
Comments and Questions 7
Acknowledgments 8
Reviewers 8
SimeonGreene 8
VaughnSpurlin 9
JackWoehr 9
JesseGlick 9
TimBoudreau 10
2 Getting and Installing the IDE
Platforms and Requirements 11
What are the system requirements to run NetBeans? 11
Getting and Installing a JDK 12
The Java Development Kit 12
Relationship of JDK to JRE 13
Obtaining the JDK 13
Which IDE Distribution? 14
Installing Binary Distributions 15
Building the IDE from Source (Simple builds) 16
What you'll need to build the IDE 16
Setting up and performing the build 17
Where did everything go? 18
How do I install a newly built version of NetBeans? 18
Running the IDE 19
Minimalenvironment 19
How to Launch NetBeans 20
Multiple NetBeans users 21
Troubleshooting 22
Updating the IDE Automatically 25
The Update Center 25
Configuring the Update Center 26
SetupWizard 27
You're now running NetBeans 27
3 Concepts and Paradigms
NetBeans and the Java abstract model of computing 29
Trang 3Objects in the UI are represented by NetBeans nodes 30
Data objects, nodes, and the concept of actions and properties 31
Tabs in the Explorer and their purposes 38
NodeParadigms 44
Sometimes Explorer Gets Behind the Times 47
Filesystems and the CLASSPATH 48
Creating Packages and Classes 52
CreatingPackages 52
CreatingClasses 52
Services 55
Compilerservices 55
Executionservices 57
Debuggingservices 57
Workspaces 58
Editing 59
GUIEditing 59
Browsing 59
Running 59
Debugging 59
Persistence across sessions 59
Using multiple instances of Explorer in different workspaces 60
Using multiple instances of the Source Editor in different workspaces 60
ProjectManagement 60
Managing multiple projects 61
Managing project builds using Ant 62
ObjectBrowser 63
Summary 66
4 Working with the Source Editor
Why learn a new editor? 68
Opening the Source Editor 68
Contextmenus 69
Closing the Source Editor 69
Codecompletion 69
Using (and Not Using) NetBeans Source Editor Code Completion 70
Updating the parser database to include new classes 71
Abbreviations 73
Editorcolorings 74
Shortcuts 75
Wordmatching 76
Indentation engines and code formatting 77
Automaticedits 77
Other Editor Functionality 78
Creating, editing, compiling and running a simple example 79
More on Customizing the Source Editor 82
5.Debugging
DebuggerTypes 83
BreakpointTypes 84
Adding and removing breakpoints 85
Settingwatches 89
Starting the Debugger 89
The Debugger Window 90
The Variables View 92
Remote Debugging in NetBeans 93
Trang 4How to debug remotely 93
Caveats 95
Advancedfeatures 96
6 Compilation and Execution Services
Using Custom Compilation and Execution Services 97
Creating and Customizing Internal Compilation Services 97
Creating and Customizing External Compilation Services 98
The Internal Execution Service 103
Creating and Customizing External Execution Services 103
Associating Services With Java Files 104
Setting Default Services for Java Files 104
Setting Services for Specific Files 104
Building With Ant 104
Creating a Build Script 104
Configuring the Ant Module 107
Executing and Compiling With Ant Scripts 108
Why Use Ant? 108
7 Customizing the environment
The Setup Wizard 109
General NetBeans Settings 109
ModuleInstallation 112
UpdateCenter 112
The ToolsOptions Dialog 113
ConfiguringToolbars 114
ConfiguringMenus 116
ConfiguringEditors 117
Object Type Associations 117
EditorSettings 118
Command line options 126
Modules 128
InstallingModules 128
Enabling and Disabling Modules 131
8 Using Source Control (CVS)
What is CVS? 133
The How, When and Why of CVS in NetBeans 135
When to use CVS 135
Where to get a client 135
How does NetBeans interact with CVS? 135
Using Generic VCS 136
Using Command-Line CVS Support versus Built-in CVS 136
What parts of my project does CVS within NetBeans save? 137
Does NetBeans automatically add new files and packages I create to the repository? 137
How do I manipulate my NetBeans project directly with CVS outside of NetBeans? 137
Mounting CVS sources 138
Exploring Versioned Sources 138
Performing common CVS operations within the IDE 139
Checkout/Get 140
Checkin/Commit 141
Add and Import 141
Log 142
Diff 143
Update 144
UnexpectedResults 144
Spurious [Local] Designation 144
Trang 5When Adding directories 145
When Adding binary files 145
Uncommon CVS operations within the IDE 145
Branching, Merging and Tagging 146
NetBeans CVS and the Secure Shell (SSH) 146
Mounting and Customizing a Generic Versioning System 146
One Final Tip 149
9 GUI Building
How to create a GUI frame or panel 151
How to add components to a GUI container 155
Configuring components with the Component Inspector 156
Buildingmenus 157
How to change and configure a container's Layout 157
Working with Borders 158
Accessibility 158
Copying a Source Object 159
The Connection Wizard 159
The GridBagLayout Customizer 161
Adding event handlers 164
Using the Code Generation Properties 166
NetBeans made a mistake in code generation, what are the workarounds? 168
Containers within Containers 171
Building Complex GUIs 171
10 Java Beans
Why Should I Make Beans? 173
Creating Java Beans 173
Creating a GUI Component 174
Converting a GUI Component into a Bean 176
Adding an Event Set to a Bean 179
Generating a BeanInfo Class 181
Adding a Design-Time Icon 183
ComponentPalette 183
Adding a Category to the Component Palette 183
Adding a Bean to the Component Palette 184
Component Palette Problems 185
11 Using Javadoc
Javadoc Support in NetBeans 186
Mounting Javadocs in the Javadoc Repository 186
The Javadoc Search Tool 187
Creating your own Javadoc 190
The Auto Comment Tool 190
JavadocGeneration 193
12 Working with XML
Installing XML Support 196
Overview 197
Templates 197
Browsing and Editing 197
GeneratingDocumentation 197
Accessing with Java 197
Where's XML Schema Support? 198
XML Editors—Tree Editor and Text Editor 198
Beyond Editing XML 201
Checking and Validating XML 201
Setting the Node View 202
Trang 6Generating Separate DTD from Existing XML 203
Generating Documentation to Help Humans Understand XML 204
Generating CSS from DTD 206
Generating Java Classes to Handle XML 206
Generating a SAX Document Handler 206
Generating a DOM Tree Scanner 209
13 Developing Web Applications
Why the IDE Supports Web Application Development 214
How the IDE Provides Web Application Support 214
Creating a Web Application 214
The Filesystems View 216
The Web Project View 217
Working with JSP and HTML files 218
Advanced Web Applications Features 221
Executing Web Applications 221
Working with Servlets 222
Packaging and Deploying Web Apps 223
Deploying Web Apps 224
ConfiguringTomcat 224
A.Resources
CVSResources 227
CVSHome 227
GNU/BSD/Other Operating Systems 227
CVS GUI Clients 228
JavaEnvironments 228
JavaTools 228
Apache Software Foundation 229
Secure Shell (SSH) Resources 229
Cygwin for Windows 229
Newsgroups and Mailing Lists 230
WebSites 230
Organization of main NetBeans website 230
Mirrors 230
SunSites 230
Open source projects coded using NetBeans which include NetBeans design forms in the distribution .231
Java-oriented IDE's other than NetBeans 231
Bibliography
ExtendingNetBeans
Foreword—by James Gosling
1.Introduction
Who Should Read this Book? 249
What’s Different about NetBeans? 250
The Core and the Open APIs 250
TheLicense 251
Open-Source 252
The netbeans.org Web Site 252
NetBeans for Bean Counters 254
Getting and Installing the Open APIs Support Module 255
Life is Change 256
Source code for the examples 256
2 History of NetBeans
HumbleBeginnings 257
First Successes, First Costs 258
Trang 7Sun Meets NetBeans 259
Open-Source, Fire-Drill Style 260
NetBeansToday 260
3 Understanding the NetBeans APIs
Design Philosophy of NetBeans 261
Abstracting the Abstractions—the Open APIs 262
Modularity 262
Hierarchy, Files and Nodes 263
Everything is a File—Virtually 263
Mapping Files to Java Objects 264
The System Filesystem 265
ModuleLayers 265
Layers in the System Filesystem 266
Exploring the System Filesystem 267
Data Objects—Wrappers for Persistent Data 270
NetBeans and JavaBeans 270
Nodes—the Application as Hierarchy 270
Presenting Nodes to the User—Explorer 271
User-LevelCustomization 273
Nodes in Action—Customizing the IDE without Writing Code 275
Modules—Overview 278
How Modules Add Functionality 278
How Modules Install Virtual Filesystem Layers 279
What Modules Can Do 279
DisablingModules 280
An Illustration—NetBeans with No Modules at All 280
Interacting with the IDE through Internal Execution 281
Setting the Status Bar Text 282
Setting the Current Workspace 283
4 The Open APIs
The IDE’s Architecture and the APIs 284
APIs versus Core versus Modules 285
Service Provider Interfaces and Client APIs 286
Overview of the APIs and Their Purposes 286
Modules 287
Lookup and the Services API 294
Nodes 296
Datasystems 299
Explorer 299
Actions 304
Options 305
Compiler 305
Editor 306
WindowingSystem 307
Cookies 309
Execution 310
JavaHierarchy 310
Filesystems 311
Modules, JARs, and Class Loaders 312
Threading, Deadlocks, and How to Avoid Them 317
5 Developing Modules—the New Module Wizard
The HelloWorld Module 319
Creating a Module Using the New Module Wizard 319
The Source Files 320
Trang 86 Internals of the Running IDE
The Activated Node(s) 323
Cookies 324
A Peek under the Hood—Examining the Activated Nodes with the CurrentNodeViewer 325
Touring NetBeans with the Bean Browser 325
Data Objects, Nodes and Cookies 327
Filesystems and the Repository 327
Services 328
Lookup 329
Options 330
UIComponents 331
TopComponents, Modes and Workspaces 331
Actions 336
Presenters 337
Custom Property Editors 337
Localization 337
Wizards 338
Jumping-offPlaces 338
Special Folders in the System Filesystem 339
7 Creating the QuickPanel Module
Abstractions Covered in this Chapter 342
Creating the Project Files Drop-Down 343
FilterNode—Filtering Which Children of a Node are Displayed 347
Creating the Methods Drop-Down 349
Improving the Methods Drop-Down 350
Creating the Module 353
Creating a Container GUI Component 354
Creating the ShowQuickPanelAction 354
Creating the XML Filesystem Layer 355
Creating and Populating the Module JAR 356
Building and Testing the Module 356
A Little Homework 357
8 A Mail-Based Filesystem
Building a Mail Reader in the NetBeans Paradigm 358
Implementing MailFileSystem Using AbstractFileSystem and JavaMail 359
Creating a New AbstractFileSystem Implementation 359
Mail Filesystem: AbstractFileSystem.Info 360
Mail Filesystem: AbstractFileSystem.List 361
Mail Filesystem: AbstractFileSystem.Change 362
Mail Filesystem: AbstractFileSystem.Attr 363
Other Parts of AbstractFileSystem 363
Creating Folder Objects for Attachments 366
Using FileSystem.Status Annotations to Mark Unread Messages 367
BeanInfo—Displaying Filesystem Properties 369
Using the Wizard Framework to Set Up Mail Accounts 371
Creating Wizard Classes 371
The IMAP Mail Server Template Wizard 372
9 Creating the User Interface for the Mail Client
Creating a DataLoader for Messages 381
Displaying and Editing Simple Messages and Unnamed Attachments 382
Handling Multipart Messages 386
Creating a Threaded Mail View Using Filter Nodes 387
Making a Basic Mail View 388
Making a Threaded Mail View as an Alternative 394
Trang 9Creating a Mail Workspace 400
10 Score File Support
Overview—Functionality to be Implemented 406
Creating the Minicomposer Module—First Things 406
Creating the Manifest 406
Creating the Layer 407
Creating a JAR File Using Ant 408
Creating a UniFileLoader and MultiDataObject for *.score Files 408
Creating an Editor Support for Scores 411
Creating a Fixed ExecCookie to Play Scores 414
Creating a Simple Template 417
11 Creating a Structural View of the Score
Creating a ScoreCookie to Represent a Sequence of Notes 419
Examples of State-Based Supports in the NetBeans APIs 420
Creating a ScoreSupport 421
Why a Document is Used 421
Implementation of ScoreSupport 422
Lifecycle of the Score 426
AnOpenSupport 426
Creating an OpenCookie Implementation 427
Showing a GUI View of the ScoreCookie 429
Indicating Parse Errors on the Node 433
12 Compiling Scores
What Does NetBeans Mean by “Compilation”? 437
Creating the Compilers Themselves 437
Creating and Using the Compiler Cookie 441
Displaying an Out-of-Date Badge on Score Icons 445
13 Executing Scores
Execution Service Types—Internal and External 448
Creating the au Player Executor 448
The Internal Player 449
The External Player 451
Registering the Players as Services 454
Creating Player Configuration Support (ExecSupport) 457
Creating a SystemOption for the Default Executor 461
14 Better Score Support in the Explorer
The Clip Length Property 467
Clearing the Cache and Firing Changes 469
Adding the Property to the Property Sheet 470
Representing Notes as Subnodes Using Children.Keys 470
Using Keys to Model Children 471
Being Lazy and Cleaning Up 473
Creating the Subnodes 474
Attaching the Children to the Parent 475
Permitting Subnodes to be Renamed or Deleted 476
Deletion of Notes 476
Renaming of Notes 477
Permitting Subnodes to be Added 479
Making Read/Write Properties on Subnodes 481
ReorderingSubnodes 484
Data Transfer—Cut, Copy, and Paste of Notes and Sequences 489
Overview of the Transferables 490
Cutting and Copying 491
Pasting 492
Trang 10Drag & Drop 495
Converting Score # Text, Text # Score, Several Scores # One 495
15 Tuning Modules for Performance & Memory Footprint
Startup Performance vs Runtime Performance 501
OperatingPrinciples 501
“Nobody Will Ever Use My Module” 501
What Does My Module Really Need to Do on Startup? 501
What are the Critical Paths? 502
Techniques 503
LazyInitialization 503
Avoid Static Initializers 503
Avoid ModuleInstall Classes—Use XML Layers Instead 504
Partial Loading Considerations—InstanceCookie and InstanceDataObject 505
Use URLs Instead of CDATA Sections in XML Layers 505
Reduce the Number of Classes You Create 505
GUI Components—Wait for addNotify() 505
Using the addNotify() and removeNotify() Pattern Where Exposed by Non-GUI Classes 506
Use Weak and Soft References for Objects which May Not be Needed Forever 506
UseWeakListener 508
Avoid Excessive Event Firing 508
Avoid Overuse of Threads 508
BatchingEvents 509
SwingPerformance 509
16 Producing Modules (Packaging & Distribution)
Versioning 511
Version Numbers and What They Mean 511
SpecifyingDependencies 512
Managing Inter-Module Dependencies 513
Upgrading User Settings 516
Settings History and Physical Format 517
Upgrade Scenarios for Settings 518
What Happens When a Module is Disabled? 520
User Development Data 521
Bundling Extension Libraries 521
Referencing Libraries with Class-Path 522
Using Autoload Library Modules 523
Ad-Hoc Resources and Module Installer Validation 525
Internationalization and Accessibility 526
I18N and L10N 526
A11Y 528
JavaHelp—Writing and Distributing 529
Creating a Help Set 529
Adding a Help Set to NetBeans 531
Adding Context Help 534
Separating Help from Code 535
Supporting User-Level Java APIs 535
Supplying a Parser Database 535
BundlingJavadoc 536
Adding to the Default Classpath 537
Templates 538
BeanInstallation 539
Creating the Module JAR File within the IDE 540
Creating a Build Script Using Ant 540
Producing the nbm File 541
Trang 11Publishing Using the Update Center 543
Using ErrorManager to Log Problems 545
Testing 547
17 Building Your Distribution of NetBeans
Do You Need Your Own Distribution? 549
Licensing 550
Selecting a Baseline 550
Getting the Sources 551
How to Customize the Build Process to Add Your Modules 552
Adding Modules to a “Stock” Distribution 553
Creating Preconfigured Settings 555
Branding 555
Implementing Branding on a Distribution 556
Simple Branding: Text Strings and Images 557
Configuration Branding: Menu Bar, Workspaces, … 558
Advanced Branding: Patching Behavior 564
A A Tour of Existing Modules to Use and Learn From
Modules that Expose Functionality Your Module Might Need 569
The XML Modules 569
TheEditor 570
Version Control—the VCS Core Module 570
RemoteFS 571
The Ant Module 571
The Java Module 571
DebuggerCore 572
J2EEServer 572
FormEditor 572
HTTP Server Module 572
Classfile Reader Module 572
The Metadata Repository—a Whole Host of APIs 572
Socket-Based Editor Support—the External Editor Module 573
Incidental APIs, Utilities and Extensions 573
The Utilities Module 573
API Extensions (openidex) 573
Modules which Make Good Examples for Things You May Need to Implement 574
Annotations and Dynamic Editor Tool Tips—the Ant Module and the Debugger Core Module .574
Adding Information to the View of Java Sources—the Beans Module 574
Adding a Debugger Type—the Applet Module 574
Multiplexing DataObjects, and Complex Cut/Copy/Paste Support—the Properties Module 574
Working with Network Protocols to Access Files—JavaCVS and RemoteFS 574
Domain-Specific XML Support—the Tomcat and Ant Modules 575
Stretching the Limits—the Web Modules 575
Complex Syntax Coloring—the JSP Module 575
Multi-Stage Compilation—the JSP, RMI, and CORBA Modules 575
Bridging to an Entirely Different Build System—the Ant and Makefile Modules 575
Use of the Compiler Infrastructure for Non-Compilation Tasks—the JAR Packager Module 576
Execution—the Applet and JSP/Servlet Modules 576
Custom Hyperlinking in the Output Window—the Ant Module 576
Specifying Windows, Workspaces and Components Using XML—the Core Window System and the Form Editor Module 576
Complex Work with MIMEResolvers and Multi-File DataObjects—the CPP Module 577
Cut/Copy/Paste—Data Transfer Support for Complex Elements—the Ant and Java Modules .577
Trang 12Interconversion between Different Types of Clipboard Contents—JNDI, CORBA, and RMI 577
Integrating Other Programming Languages—the C++/Fortran, Scripting, and WebL Modules .577
Fancy Footwork with Nodes—the Java Module 578
Adding Nodes to the Runtime Tab in the Explorer—the RMI, CORBA, JNDI, and Database ExplorerModules 578
The Bare Essentials of Non-Data-Driven Nodes—the System Properties Module 578
Wizards—the CORBA, Java and New Module Wizard Modules 578
Embedding Property Panels into Wizards—the Java Module 578
Complex Explorer Views—the Debugger Core Module 578
Enabling/Disabling Sets of Actions based on Context—the VCS Core Module 579
B Useful Utility Classes
XMLUtilities 580
org.openide.xml.XMLUtil 580
org.openide.xml.EntityCatalog 580
Visual Components and Extensions to Standard Swing Components 580
LookupImplementations 581
Threading 581
Miscellaneous Utility Classes in org.openide.util 581
SerializationHelpers 582
C Future Plans
DeclarativeInstantiation 583
UniformLookup 583
DatasystemsII 584
The Looks API 584
DeclarativeActions 585
Deprecation of IDE-Specific Functionality in the Open APIs 585
The Metadata Repository 585
Standards Employed by the MDR 586
ProjectSupport 587
D Working with Open-Source and NetBeans
Practices 589
Governance 589
Consensus 590
How to Get Involved 595
The Lifecycle of Module Development 600
Resources 602
CVS (Concurrent Versioning System) 602
Projects 602
MailingLists 602
Issuezilla 603
Interacting Effectively on Mailing Lists 604
E Additional Modules and Where to Find Them
Open-Source Modules Available via the Update Center 606
The Modules Marketplace on Flashline 606
IDEs that are Distributions of the NetBeans IDE 608
Open-Source Application Projects Based on NetBeans 609
Commercial Applications Built on the NetBeans Platform 609
Commercial Modules Available for NetBeans 610
Should You Create Your Own Update Server? 612
Glossary
Trang 13NetBeans in a Nutshell
Trang 16Table of Contents
1.Introduction
Is NetBeans For You? 1
Is This Book For You? 2
NetBeans and Java 2
What are Java Beans? 2
The Core Concept of NetBeans 3
NetBeans as the "Visual JDK" 4
All The Usual Features 4
NetBeans as a tools platform 5
NetBeans as an open source community 6
A Steady Stream of Creativity 6
Don't Be Cross That This Book Is Cross-Platform 6
Contents of the Accompanying Sources 7
Licensing of the Code Examples in this Book 7
Writing Conventions in this Book 7
Comments and Questions 7
Acknowledgments 8
Reviewers 8
SimeonGreene 8
VaughnSpurlin 9
JackWoehr 9
JesseGlick 9
TimBoudreau 10
2 Getting and Installing the IDE
Platforms and Requirements 11
What are the system requirements to run NetBeans? 11
Getting and Installing a JDK 12
The Java Development Kit 12
Relationship of JDK to JRE 13
Obtaining the JDK 13
Which IDE Distribution? 14
Installing Binary Distributions 15
Building the IDE from Source (Simple builds) 16
What you'll need to build the IDE 16
Setting up and performing the build 17
Where did everything go? 18
How do I install a newly built version of NetBeans? 18
Running the IDE 19
Minimalenvironment 19
How to Launch NetBeans 20
Multiple NetBeans users 21
Troubleshooting 22
Updating the IDE Automatically 25
The Update Center 25
Configuring the Update Center 26
SetupWizard 27
You're now running NetBeans 27
3 Concepts and Paradigms
NetBeans and the Java abstract model of computing 29
Explorer 30
Trang 17Objects in the UI are represented by NetBeans nodes 30
Data objects, nodes, and the concept of actions and properties 31
Tabs in the Explorer and their purposes 38
NodeParadigms 44
Sometimes Explorer Gets Behind the Times 47
Filesystems and the CLASSPATH 48
Creating Packages and Classes 52
CreatingPackages 52
CreatingClasses 52
Services 55
Compilerservices 55
Executionservices 57
Debuggingservices 57
Workspaces 58
Editing 59
GUIEditing 59
Browsing 59
Running 59
Debugging 59
Persistence across sessions 59
Using multiple instances of Explorer in different workspaces 60
Using multiple instances of the Source Editor in different workspaces 60
ProjectManagement 60
Managing multiple projects 61
Managing project builds using Ant 62
ObjectBrowser 63
Summary 66
4 Working with the Source Editor
Why learn a new editor? 68
Opening the Source Editor 68
Contextmenus 69
Closing the Source Editor 69
Codecompletion 69
Using (and Not Using) NetBeans Source Editor Code Completion 70
Updating the parser database to include new classes 71
Abbreviations 73
Editorcolorings 74
Shortcuts 75
Wordmatching 76
Indentation engines and code formatting 77
Automaticedits 77
Other Editor Functionality 78
Creating, editing, compiling and running a simple example 79
More on Customizing the Source Editor 82
5.Debugging
DebuggerTypes 83
BreakpointTypes 84
Adding and removing breakpoints 85
Settingwatches 89
Starting the Debugger 89
The Debugger Window 90
The Variables View 92
Remote Debugging in NetBeans 93
How to debug remotely 93
Trang 18Advancedfeatures 96
6 Compilation and Execution Services
Using Custom Compilation and Execution Services 97
Creating and Customizing Internal Compilation Services 97
Creating and Customizing External Compilation Services 98
The Internal Execution Service 103
Creating and Customizing External Execution Services 103
Associating Services With Java Files 104
Setting Default Services for Java Files 104
Setting Services for Specific Files 104
Building With Ant 104
Creating a Build Script 104
Configuring the Ant Module 107
Executing and Compiling With Ant Scripts 108
Why Use Ant? 108
7 Customizing the environment
The Setup Wizard 109
General NetBeans Settings 109
ModuleInstallation 112
UpdateCenter 112
The ToolsOptions Dialog 113
ConfiguringToolbars 114
ConfiguringMenus 116
ConfiguringEditors 117
Object Type Associations 117
EditorSettings 118
Command line options 126
Modules 128
InstallingModules 128
Enabling and Disabling Modules 131
8 Using Source Control (CVS)
What is CVS? 133
The How, When and Why of CVS in NetBeans 135
When to use CVS 135
Where to get a client 135
How does NetBeans interact with CVS? 135
Using Generic VCS 136
Using Command-Line CVS Support versus Built-in CVS 136
What parts of my project does CVS within NetBeans save? 137
Does NetBeans automatically add new files and packages I create to the repository? 137
How do I manipulate my NetBeans project directly with CVS outside of NetBeans? 137
Mounting CVS sources 138
Exploring Versioned Sources 138
Performing common CVS operations within the IDE 139
Checkout/Get 140
Checkin/Commit 141
Add and Import 141
Log 142
Diff 143
Update 144
UnexpectedResults 144
Spurious [Local] Designation 144
When Adding directories 145
Trang 19When Adding binary files 145
Uncommon CVS operations within the IDE 145
Branching, Merging and Tagging 146
NetBeans CVS and the Secure Shell (SSH) 146
Mounting and Customizing a Generic Versioning System 146
One Final Tip 149
9 GUI Building
How to create a GUI frame or panel 151
How to add components to a GUI container 155
Configuring components with the Component Inspector 156
Buildingmenus 157
How to change and configure a container's Layout 157
Working with Borders 158
Accessibility 158
Copying a Source Object 159
The Connection Wizard 159
The GridBagLayout Customizer 161
Adding event handlers 164
Using the Code Generation Properties 166
NetBeans made a mistake in code generation, what are the workarounds? 168
Containers within Containers 171
Building Complex GUIs 171
10 Java Beans
Why Should I Make Beans? 173
Creating Java Beans 173
Creating a GUI Component 174
Converting a GUI Component into a Bean 176
Adding an Event Set to a Bean 179
Generating a BeanInfo Class 181
Adding a Design-Time Icon 183
ComponentPalette 183
Adding a Category to the Component Palette 183
Adding a Bean to the Component Palette 184
Component Palette Problems 185
11 Using Javadoc
Javadoc Support in NetBeans 186
Mounting Javadocs in the Javadoc Repository 186
The Javadoc Search Tool 187
Creating your own Javadoc 190
The Auto Comment Tool 190
JavadocGeneration 193
12 Working with XML
Installing XML Support 196
Overview 197
Templates 197
Browsing and Editing 197
GeneratingDocumentation 197
Accessing with Java 197
Where's XML Schema Support? 198
XML Editors—Tree Editor and Text Editor 198
Beyond Editing XML 201
Checking and Validating XML 201
Setting the Node View 202
Generating Separate DTD from Existing XML 203
Trang 20Generating Documentation to Help Humans Understand XML 204
Generating CSS from DTD 206
Generating Java Classes to Handle XML 206
Generating a SAX Document Handler 206
Generating a DOM Tree Scanner 209
13 Developing Web Applications
Why the IDE Supports Web Application Development 214
How the IDE Provides Web Application Support 214
Creating a Web Application 214
The Filesystems View 216
The Web Project View 217
Working with JSP and HTML files 218
Advanced Web Applications Features 221
Executing Web Applications 221
Working with Servlets 222
Packaging and Deploying Web Apps 223
Deploying Web Apps 224
ConfiguringTomcat 224
A.Resources
CVSResources 227
CVSHome 227
GNU/BSD/Other Operating Systems 227
CVS GUI Clients 228
JavaEnvironments 228
JavaTools 228
Apache Software Foundation 229
Secure Shell (SSH) Resources 229
Cygwin for Windows 229
Newsgroups and Mailing Lists 230
WebSites 230
Organization of main NetBeans website 230
Mirrors 230
SunSites 230
Open source projects coded using NetBeans which include NetBeans design forms in the distribution .231
Java-oriented IDE's other than NetBeans 231
Bibliography
Trang 21List of Figures
2.1 NetBeans Minimum Requirements on Several Popular Platforms 12
2.2 Summary of tradeoffs between NetBeans releases 14
5.1 Debugger Types 83
5.2 Setting Breakpoints 86
5.3 Add Breakpoint dialog 87
5.4 Set Breakpoint Type Variable 88
5.5 Starting the Debugger 90
5.6 Debugger Window 91
5.7 Modifying a Variable 92
5.8 The Attach dialog box 94
5.9 The Debugger window 95
6.1 The Internal Compiler Service 97
6.2 JDK 1.1 External Compilation Service 99
6.3 Environment variables property editor 100
6.4 External Process configuration dialog 102
6.5 The JDK External Compiler with the nowarn argument 102
6.6 An Ant project build script 105
6.7 Adding a new Ant task 105
6.8 Ant Help page 106
7.1 The first pane of the Setup Wizard 109
7.2 An editor window with a filesystem explorer docked on the left 111
7.3 The second pane of the Setup Wizard 112
7.4 The third pane of the Setup Wizard 112
7.5 Toolbar options 115
7.6 Changing the toolbar button order 115
7.7 Creating and editing menus 116
7.8 Global key bindings 118
7.9 The fonts and colors editor 120
7.10 The color picker 121
7.11 The font picker 123
7.12 Recording a macro 124
7.13 Editing macros 125
7.14 Indentation Engine 126
7.15 IDE command line options 127
7.16 The Auto Update Center - Pane 1 128
7.17 Installing modules from the web 129
7.18 Completing Installation of modules for the web 130
7.19 Installing modules manually 131
8.1 Summary of how CVS extends RCS 134
8.2 The Version Explorer window 138
8.3 The GUI style CVS options dialog for an update 140
8.4 Browsing the CVS log of a source tree 142
8.5 Performing a CVS diff operation 144
8.6 Pulling down the Versioning menu 146
8.7 The Versioning Window for CVS 147
8.8 Advanced options for the CVS Versioning window 147
8.9 Editing generic versioning commands 148
9.1 Creating the GuiDemoBasic package 152
9.2 Creating the AddStrings JFrame 154
9.3 The NetBeans Form Editor 155
9.4 The GuiBasicDemo example being tested 156
Trang 229.5 Testing the form with a FlowLayout 1569.6 GuiDemoBasic using GridLayout 1579.7 The Connection Mode button 1609.8 Testing after linking events 1609.9 A GridBaglayout example, with 3 rows and 5 columns 1619.10 GridBagLayout Customizer dialog 1629.11 Generating an ExitItem event 1659.12 Selecting an event handler 1659.13 The AddStrings example running 1669.14 Adding post-creation code 1679.15 Creating a custom template category 16910.1 Copying AddStrings components 17410.2 Testing the AddStrings Bean 17810.3 The BeanInfo Editor dialog box 18210.4 The AddStrings Bean icon 18310.5 Creating a new component palette category 18410.6 The AddStrings Bean in the component palette 18411.1 The Javadoc Repository 18611.2 The Javadoc Search Tool 18711.3 Select the text to search for in Javadocs and hit Ctrl+F1 18911.4 The search tool starts with your text and matching results 18911.5 The Javadoc Auto-Commenting Tool 19111.6 Adding Javadoc Links 19412.1 Installing modules for XML support 19612.2 The XML tree editor and text editor 19812.3 Adding a new attribute 19912.4 DTD and data nodes 20212.5 DTD separated from an XML document 20313.1 A web application directory structure in Filesystem view 21513.2 The Web Project View 21713.3 Adding a new JSP 21913.4 JSP Page in Browser 22113.5 Creating a new servlet 22213.6 Selecting a default application server 22413.7 Configuring The Tomcat Server 225
Trang 23List of Tables
5.1 Debugger Types that come with NetBeans 3.3 5.2 Runtime events that can be used to trigger a breakpoint define the following Breakpoint Types 5.3 Debug Menu Options 6.1 Configuration Properties for the Internal Compilation Service .6.2 Expert Configuration Properties for the Internal Compilation Service 6.3 Configuration Properties for the External Compilation Service 6.4 Expert Configuration Properties for the External Compilation Service 6.5 Configuration Properties for the External Execution Service 6.6 Expert Configuration Properties for the External Execution Service 6.7 Properties for Ant Settings 6.8 Properties for the Ant Compiler 7.1 Object Types 7.2 Java Indentation Engine Properties 7.3 IDE Command Line Arguments 9.1 Text and Editable Property Settings for AddStrings Components 9.2 Names for AddStrings Components 9.3 Menu Item Properties for AddStrings 9.4 Customizer Properties 10.1 Setting wizard properties for the AddStrings Bean 10.2 Setting component directions 10.3 Setting wizard properties for event listeners 11.1 Javadoc Search Tool Buttons 11.2 Method Filtering Buttons 11.3 External Javadoc Executor 11.4 External Javadoc Executor 11.5 Additional Doclet Properties 12.1 Printing Element Names in Inventory_InventoryScanner 12.2 Printing Attribute Values in Inventory_InventoryScanner 12.3 Printing Element Data in Inventory_InventoryScanner 12.4 Modifying Attribute Values in Inventory_InventoryScanner 13.1 Features Added by the JSP/Servlet Module 13.2 Templates for Creating Web Application files
Trang 24List of Examples
3.1 Example 3-1 A NetBeans form file 365.1 Multithreaded Example for Debugging Demo—ThreadedCounter.java 8510.1 Code in AddStrings JFrame needed for the new Bean 17510.2 Code Needed in Getter and Setter methods for AddStrings Bean 17710.3 Event Handler Methods in AddStrings Bean 17810.4 Code Needed for Events in AddStrings Bean 17910.5 Beginning of ASTest3 18010.6 propertyChange Method in ASTest3 18010.7 ActionPerformed Event Handlers in ASTest3 18110.8 initComponents method for ASTest4 18512.1 Inventory.xml after adding elements and attributes 20012.2 DTD text for Inventory.xml 20112.3 HTML documentation for Inventory.xml 20512.4 Cascading Stylesheet for Inventory.xml 20612.5 main method for Inventory_InventoryParser 20712.6 characters method for Inventory_InventoryHandlerImpl 20712.7 startElement method for Inventory_InventoryHandlerImpl 20812.8 Output from Inventory_InventoryHandlerImpl 20812.9 main method for Inventory_InventoryScanner 20912.10 visitElement_Part method with all changes applied 21012.11 main method with all changes applied 21112.12 import statements for Transformer references 21212.13 Output from Inventory_InventoryScanner 21213.1 Source Listing for index.jsp 220
Trang 25Chapter 1 Introduction
Table of Contents
Is NetBeans For You? 1
Is This Book For You? 2NetBeans and Java 2
What are Java Beans? 2The Core Concept of NetBeans 3NetBeans as the "Visual JDK" 4
All The Usual Features 4NetBeans as a tools platform 5NetBeans as an open source community 6
A Steady Stream of Creativity 6Don't Be Cross That This Book Is Cross-Platform 6Contents of the Accompanying Sources 7Licensing of the Code Examples in this Book 7Writing Conventions in this Book 7Comments and Questions 7Acknowledgments 8
Reviewers 8SimeonGreene 8VaughnSpurlin 9JackWoehr 9JesseGlick 9TimBoudreau 10
Is NetBeans For You?
Is NetBeans for you? The algorithm for answering this question, is:
1 Determine what NetBeans does
2 Decide if that functionality is for you
NetBeans is first and foremost a well-crafted open source programmer's integrated development environment (IDE) It'spowerful, it's useful, it's extensible, it's open and it's free
Sometimes integrated development environments are misunderstood as intended to make Java programming easier.You know already, though, that advanced tools don't save work so much as they make the same amount of work yieldmore effective results
That's what NetBeans does; it allows you to trade one set of practices for another The practices which NetBeans poses are fully as intricate as your current development practices More intricate, perhaps, because if you are a real pro-grammer, you will wish to supplement your work style with NetBeans rather than attempting to use NetBeans to com-pletely replace your current work style The practice of NetBeans development is not easier It's just more effectivethan what you were doing before NetBeans You get more done with NetBeans
im-Chapter 1 Introduction
1
Trang 26Is This Book For You?
Well, for a start, NetBeans: The Definitive Guide is a book written by a select team of NetBeans enthusiasts and
ex-perts, all of whom are talented and experienced programmers Some have used NetBeans almost since the beginning.Each has had his theories of programming using NetBeans tested in real world software engineering
Also, members of the NetBeans development team watched over the evolution of this book, making suggestions, recting misapprehensions, sometimes disagreeing with the authors' conclusions in the course of a long-distance groupauthorship project conducted over the Internet, a project which took almost two years to complete
cor-What's more, during the period in which the authors were preparing this book, NetBeans was changing Features cameand went Visual layout changed, thus rendering carefully arranged screenshots out-of-date Whole components ap-peared in and disappeared from the NetBeans core If you've ever studied the computer science heuristic of "simulatedannealing" you'll recognize the process which this book underwent: like a seven-folded samurai sword, our work hasbeen melted and hammered out flat over and over again
NetBeans: The Definitive Guide presumes that you are a NetBeans beginner, not a beginner programmer We are not
going to teach you programming; we're going to teach you how to use NetBeans to enhance your programming tivity
produc-NetBeans and Java
Sun Microsystems' Java programming environment has transformed the software development model of many gramming teams Designed not only for portability and rapid prototyping, Java is as much a prefabricated software de-velopment methodology as a programming language Life isn't always as simple as the Java approach tries to make it,but it is that simple often enough that Java is a good bet for many projects
pro-If you have no extraordinary requirements, the basic Java model of development is handy to use pro-If you happen to havespecial requirements, the power and flexibility of Java combined with access to other code bodies via language re-sources such as JNI, the Java Native Interface, and runtime protocols such as TCP/IP and RMI, Java's Remote MethodInvocation layer, tend to assure that some Java-based solution is within practical reach
Java is huge yet hugely consistent The core Java development tools sprang from the same collective brow as did thelanguage itself For documentation, there's Javadoc For client-server communication, there's RMI Even the IDE, orrather, any number of IDE's from any number of vendors, were anticipated
What are Java Beans?
Java was intended from its earliest days to cater to the integrated development model of drag-and-drop program position Apropos this requirement, among the core methodologies designed into Java development you will find theJava Beans [http://java.sun.com/beans/docs/spec.html] specification
com-Java Beans are an instance of the general design pattern of mapping a single fundamental entity onto a multiple-classimplementation As handy as the metaphor of object orientation has proven, real programming goes well beyond "justobjects" in complexity of structure Performing design decomposition on modern programs reveals that they tend toconsist of fundamental entities which cannot conveniently be mapped just to single classes in any practical program-ming language Java Beans is one possible multiple-class mapping of a design concept
If you think objects should communicate and cooperate reflexively, then Java Beans agrees with you Java Beans
repre-Chapter 1 Introduction
2
Trang 27sent the object's ability to communicate with other entities, usually beyond runtime to design time, compile time andconfiguration time.
Sun engineers identified early on in the life of Java one particularly interesting category of entity requiring a class implementation, that of the reusable visual component Such a component has both a runtime persona and a de-sign-time persona Components of this sort are used in an integrated development environment such as NetBeans Eachdrag-and-drop component used in an IDE to design programs needs both a runtime class which embodies the compo-nent functionality and a design-time class which the IDE employs for the visual representation and manipulation of theclass
multiple-The Java Beans framework, while widely applicable beyond the creation of visual design components, has received itsbroadest exposure in that domain Visual Java Beans allow a component author to map the design persona of the com-ponent onto a separate Java class — the BeanInfo class — from the component's runtime class in a fashion portable be-tween different IDE's This design-time persona is critical to establishing a visual representation of the component tothe user and to establishing a properties metaphor for configuring the component in the design tool On the other hand,the design-time persona is excess baggage at runtime The packaging of the design-time persona of a reusable visualentity into a secondary class allows superfluous information to be discarded at runtime
Java as an object-oriented programming environment possesses a more complete object model than does, say, C++.Java objects are capable of reflection This means that objects and methods exist within Java to allow examination(often called reflection, sometimes called introspection) of an object's methods and data
The Java Beans framework takes advantage of Java reflection by creating classes whose main purpose is to be a tory of information about another class These Bean classes each typically bear the name of the first-order class theyshadow with "BeanInfo" appended to the name A BeanInfo class can itself be composed algorithmically in software,either by automated examination of the source code for the first-order class, or by using reflection to examine the com-piled form of the first-order class Additional information about the first-order class may be contained within the Bean-Info class; for example, in the case of a visual widget, the BeanInfo class contains information about the default size, ti-tle, colors and orientation of the first-order class, and often an embedded icon to be used to represent the first-orderclass on the toolbar Additionally, the Bean may possess methods which communicate application-specific information
reposi-to reposi-tools aware of the significance of that information
Enterprise Java Beans
A more sophisticated application of the design pattern of mapping an entity to multiple classes is the Enterprise JavaBean (EJB) [http://java.sun.com/products/ejb/white.html], where we find three classes — the home interface, remoteinterface, and implementation classes — collectively constituting one transactional entity, rather than a visual entity.Interestingly, the name "NetBeans" was chosen because the early authors of the IDE were working on just such a trans-actional "bean" design pattern when their efforts were pre-empted by Javasoft's announcement of the Enterprise JavaBeans architecture But the EJB architecture is subject matter for another book!
The Core Concept of NetBeans
The basic Java Beans design pattern was conceived primarily to ensure that factoring and component reuse would come the norm in Java programming The core concept of NetBeans visual development is the design pattern of com-posing program components packaged as Java Beans out of sub-components themselves packaged as Java Beans.This might be called the "matryoshka doll pattern" of software design, after the Russian folk-art of nested dolls, each ofwhich is structurally complete in itself yet whose "semantic" resides in its recursively containing other structurallycomplete dolls
be-NetBeans makes use of Java Beans and the generation of new Java Beans so automatic that it's almost always easier togenerate a simple component, "bean" it, and drag it into the next-higher-level component you wish to compose than to
Chapter 1 Introduction
3
Trang 28do things any other way.
The architects of Java were largely successful in achieving this goal of providing a usable and compelling model forcomponent packaging And in the vanguard of this success we find NetBeans™, the subject of our book
Note
In case you were wondering, many programmers use NetBeans productively without often (or ever) strayinginto Bean construction
NetBeans as the "Visual JDK"
NetBeans is an IDE, an integrated development environment As such, it resembles other IDEs used in modern ware engineering for authoring programs in languages such as C/C++, Forth, Ada, Fortran, Cobol, and RPG NetBeans,however, is integrated with the code which is developed under NetBeans in a way which is impossible in many otherlanguages (though Forth, Smalltalk and LISP foreshadowed this sort of introspective language structure) It is as if Net-Beans were itself the visual manifestation of the Java Development Kit and of the Java Foundation Classes (Swing).Per the core concept of NetBeans, the essential model of visual programming is as follows:
soft-1 Use Java Beans from the NetBeans component palette to create a visual component
2 Wrap that component as a Java Bean
3 Add that component to the NetBeans component palette, either to an extant palette or to a user-specific or tion-specific palette
applica-4 Utilize the new component in the creation of more complex enclosing visual components
The process is repeated as many times as necessary, both forming many components out of the same selection of JavaBeans, and continually enhancing the palette by the more deeply nested Java Bean composition
Thus a simple visual program is composed of a small selection of top-level Java Beans and any wrapper or non-visualhelper classes that are required
All The Usual Features
NetBeans offers all the usual and expected features of an IDE:
• a syntax-coloring editor aware not only of the Java language, but also XML, HTML and many other languages
Trang 29The NetBeans Object Browser has in the latest revisions of NetBeans moved out of the core to become an tional external module which you may install via the NetBeans Update Center if you so choose.
op-• debugger
• integrated source control support for
• external CVS
• built-in CVS
• most external source control systems of your choice
• In addition to its own internal build system and compiler, NetBeans offers integration with external compilers and
an external build system, Jakarta Ant [http://jakarta.apache.org/ant/index.html], one which is rapidly becoming thedominant build tool in the Java/XML world and beyond
• "Wizard" dialogs to assist the user at choice points
along with many other features and tools about which you will read about later in this book
NetBeans as a tools platform
NetBeans is an extraordinarily versatile tools platform We could say that NetBeans is like a Swiss army knife ontowhich new blades can be attached at any time
NetBeans itself is written wholly in Java, which is why it runs on any platform which supports the Java DevelopmentKit (JDK) Furthermore, the runtime configuration of NetBeans is described in XML When the core of NetBeansloads, it configures and launches the rest of the system The core reads the XML description and loads the appropriatemodules, that is, components written in Java against the NetBeans API
It is this modules concept which allow extension of NetBeans Many or most of the important features of NetBeans aremodules which can be detached from the system and upgraded as needed And since NetBeans is open source software,you are free to modify and recompile any modules whose behavior you wish to change
Thus, NetBeans has an close relationship with the programs it is developing that most other IDE's do not possess Beans itself is developed in NetBeans, and any NetBeans user who wishes to join in may be part of that process
Net-In fact, NetBeans is so attractive a platform for tool architects that over eighty organizations have specifically portedtheir tool applications to NetBeans modules in order to make it more convenient for developers to use their tools Visitthe Who is building on top of NetBeans [http://www.netbeans.org/third-party.html] page to browse the eclectic mix oftarget applications from business and industry which use NetBeans as their development front end or as glue to holdtheir application presentation together
Beyond the usefulness of adding features by adding modules to NetBeans, understanding how the individual toolswhich make up the NetBeans experience interoperate is a beneficial exercise for understanding the integration of com-ponent-based software Whatever applications you wish to develop using NetBeans, if you work diligently and arelucky, over time the programs you write will come to be as well architected as NetBeans itself!
Chapter 1 Introduction
5
Trang 30NetBeans as an open source community
A Steady Stream of Creativity
Many "real programmers" are not well-disposed towards integrated development environments An IDE is no substitutefor knowing the fine details of a programming language and its toolchain Some IDE's surreptitiously introduce into a
program de jure dependencies on a vendor's libraries or de facto human dependency on the IDE for program
mainte-nance Worse, many IDE's obstruct the flow of creativity and impose their theories of software engineering upon theworkflow in a fashion likely to clash with the programmer's creative muse
NetBeans shares none of these flaws to any great extent It neither ties the user to proprietary libraries, nor does it der source unmaintainable to an ordinary editor
ren-NetBeans is an IDE for the expert programmer, yet gentle and easy for the novice It achieves this by being the product
of a community of expert Java programmers who have labored to render their own Java practice more enjoyable andmore productive Such individuals have no doctrine to impose other than the doctrine of mutual assistance, free soft-ware and coding which must bear the scrutiny of the public eye
NetBeans is open Modules may be added, and perhaps more importantly, subtracted from the NetBeans installation.NetBeans source can also be modified under NetBeans and then recompiled to the tastes of the user The usefulness ofNetBeans is that there is as little of NetBeans between the programmer and his or her program as the programmer wills
Don't Be Cross That This Book Is Cross-Platform
As we have mentioned, unlike other IDE's for Java, NetBeans is coded in pure Java This means that NetBeans runs onany platform which offers the minima, particularly in terms of the Java environment
One easily anticipated result of this flexibility of NetBeans is that the various authors of this book are each working ondifferent platforms, and at different levels of this open source project Therefore, illustrations in this book will appearsomewhat inconsistent since they are drawn from screenshots of NetBeans running in the Java environments forLinux™, Solaris™, Windows™, and possibly other operating systems
We could have standardized on one platform to present the illustrations, but why play favorites? You, our readers, will
be running NetBeans on a variety of platforms The model of NetBeans behavior is consistent and pervasive even if theshape and color of its scroll bars change from platform to platform
Life is Change, Especially in Open Source
It is in the nature of open source projects such as NetBeans to change rapidly The authors of this book areworking with NetBeans 3.3.1 and are trying in this book to be as general as possible in describing the func-tionality and operation of NetBeans, since by the time you read this some bright idea unknown to us at thetime of writing may have worked its way into the latest release! Please remember this point, especially inviewing the illustrations, and do not be surprised if the layout of some or many windows has changed It's al-most certain that such will have occurred, but generally in the direction of augmented functionality Rarelydoes a feature disappear, but this too has been known to happen from release to release, when one feature isreplaced by a more advanced feature or set of features In such cases, reading through the release notes mayhelp point the way to finding the desired feature in its new location or its replacement
Chapter 1 Introduction
6
Trang 31Contents of the Accompanying Sources
The accompanying source download contains the following things:
• The source code to all of the examples in the book
• Any libraries or other code required by the examples in this book
• NBM files for complete NetBeans modules demonstrated in the half of the book on writing your own extensionsmodules for NetBeans These files can be easily loaded into NetBeans in order to install the modules: just selectTools->Update Center and choose Install Manually Downloaded Modules when prompted
The accompanying sources can be downloaded from somewhere [somewhere]
Licensing of the Code Examples in this Book
All of the source code examples in this book are open-source and licensed under the Sun Public License, and you arefree to copy or reuse them or portions thereof under its terms
Writing Conventions in this Book
The structure of NetBeans, both internally and to the user, is very hierarchical Very often you will open a dialog from
a menu, which will then display a tree structure which you will need to navigate In the procedures in this book, thesecontainers are named inline—for example, “select Tools->Options+IDE Configuration+Look and Feel+MenuBar+File” refers to both menu items and entities within the tree in the dialog that appears Literally this translates to:Click the Options item on the Tools menu Expand the folder IDE Configuration, its subfolder Look and Feel, and thatfolder’s subfolder Menu Bar in the resulting dialog, and select the tree node labeled File This convention is also fol-lowed in the NetBeans documentation
We use the term$NB_HOMEto denote the base directory for an installed copy of NetBeans A similar convention ofusing Unix-style environment variables is used to denote other information that varies between systems, such as
nbuser$VERSION
For brevity, most code examples omit import statements and such—we want this book to be readable! All of the codeexamples in the book are included in full source form on the accompanying downloadable sources
Code listed in the book is generally formatted for readability and so may differ in indentation and line breaks from the
downloadable sources Where it was unavoidable to break a long line in print, but this line cannot actually be broken
without affecting meaning, a hooked arrow (#) is used at the printed break point
Comments and Questions
Please address comments and questions concerning this book to the publisher:
O’Reilly & Associates, Inc
Chapter 1 Introduction
7
Trang 32To ask technical questions or comment on the book, send email to:<bookquestions@oreilly.com>
We have a web site for the book, where we'll list examples, errata, and any plans for future editions You can accessthis page at: http://www.oreilly.com/catalog/something/ [http://www.oreilly.com/catalog/something/]
For more information about this book and others, see the O’Reilly web site: http://www.oreilly.com/[http://www.oreilly.com/]
There were others whose comments did not go through the email feedback channel, or whose names could not be cerned from their email addresses Please be assured that we greatly appreciated your contributions, even though yourname may not be included in this list