You are previewing The Definitive Guide to NetBeans™ Platform.
O'Reilly logo
The Definitive Guide to NetBeans™ Platform

Book Description

The Definitive Guide to NetBeans™ Platform is a thorough and definitive introduction to the NetBeans Platform, covering all its major APIs in detail, with relevant code examples used throughout.

The original German book on which this title is based was well received. The NetBeans Platform Community has put together this English translation, which author Heiko Böck updated to cover the latest NetBeans Platform 6.5 APIs. With an introduction by known NetBeans Platform experts Jaroslav Tulach, Tim Boudreau, and Geertjan Wielenga, this is the most up-to-date book on this topic at the moment.

All NetBeans Platform developers will be interested in purchasing it, because several topics in the book have not been documented anywhere else.

Table of Contents

  1. Copyright
  2. Foreword
  3. About the Author
  4. About the Technical Reviewers
  5. Acknowledgments
  6. Introduction
    1. How This Book Is Structured
  7. 1. Introduction: Let's Find Out What This Book Is All About!
    1. 1.1. What Is a Rich Client?
    2. 1.2. What Is a Rich Client Platform?
    3. 1.3. Advantages of a Rich Client Platform
      1. 1.3.1. Reduction in Development Time
      2. 1.3.2. User Interface Consistency
      3. 1.3.3. Updating
      4. 1.3.4. Platform Independence
      5. 1.3.5. Reusability and Reliability
    4. 1.4. Characteristics of the NetBeans Platform
      1. 1.4.1. User Interface Framework
      2. 1.4.2. Data Editor
      3. 1.4.3. Customization Display
      4. 1.4.4. Wizard Framework
      5. 1.4.5. Data Systems
      6. 1.4.6. Internationalization
      7. 1.4.7. Help System
    5. 1.5. Summary
  8. 2. Structure of the NetBeans Platform: Let's Find Out What It's Made Of!
    1. 2.1. NetBeans Platform Architecture
    2. 2.2. NetBeans Platform Distribution
    3. 2.3. NetBeans Runtime Container
    4. 2.4. NetBeans Classloader System
      1. 2.4.1. Module Classloader
      2. 2.4.2. System Classloader
      3. 2.4.3. Original Classloader
    5. 2.5. Summary
  9. 3. The Module System: Let's Understand the Basic Building Blocks!
    1. 3.1. Overview
    2. 3.2. Module Structure
    3. 3.3. Module Types
      1. 3.3.1. Regular
      2. 3.3.2. Autoload
      3. 3.3.3. Eager
    4. 3.4. Module Manifest
      1. 3.4.1. Attributes
        1. 3.4.1.1. Description
        2. 3.4.1.2. Versioning and Dependencies
        3. 3.4.1.3. Services and Interfaces
        4. 3.4.1.4. Visibility
      2. 3.4.2. Example
    5. 3.5. Module Layer
      1. 3.5.1. Order of Entries
      2. 3.5.2. Instance Files
      3. 3.5.3. Shadow Files
      4. 3.5.4. Settings Files
      5. 3.5.5. Creating and Using Your Own Contents
    6. 3.6. Creating Modules
    7. 3.7. Versioning and Dependencies
      1. 3.7.1. Versioning
      2. 3.7.2. Defining Dependencies
        1. 3.7.2.1. Module Dependencies
        2. 3.7.2.2. Java Package Dependency
        3. 3.7.2.3. Java Version Dependency
    8. 3.8. Lifecycle
    9. 3.9. Module Registry
    10. 3.10. Using Libraries
      1. 3.10.1. Library Wrapper Module
      2. 3.10.2. Adding a Library to a Module
    11. 3.11. Summary
  10. 4. Actions: Let's Make the NetBeans Platform Do Something!
    1. 4.1. Overview
    2. 4.2. Providing Action Classes
      1. 4.2.1. Always Enabled Actions
      2. 4.2.2. CallableSystemAction
      3. 4.2.3. CallbackSystemAction
      4. 4.2.4. CookieAction
      5. 4.2.5. General Context-Sensitive Action Classes
    3. 4.3. Registering Actions
    4. 4.4. Shortcuts and Mnemonics
    5. 4.5. Summary
  11. 5. User Interface Design: Let's Create Some Windows!
    1. 5.1. Overview
    2. 5.2. Menu Bar
      1. 5.2.1. Creating and Adding Menus and Menu Entries
      2. 5.2.2. Inserting Separators
      3. 5.2.3. Hiding Existing Menu Entries
      4. 5.2.4. Creating a Custom Menu Bar
    3. 5.3. Toolbars
      1. 5.3.1. Creating Toolbars
      2. 5.3.2. Configuring Toolbars
      3. 5.3.3. Modification by the User
      4. 5.3.4. Creating Custom Toolbars
      5. 5.3.5. Using Custom Control Elements
    4. 5.4. Window System
      1. 5.4.1. Introduction
      2. 5.4.2. Configuration
      3. 5.4.3. Customization
      4. 5.4.4. Window: TopComponent
        1. 5.4.4.1. Creating a TopComponent
        2. 5.4.4.2. States
        3. 5.4.4.3. Context Menu
        4. 5.4.4.4. Persistence
        5. 5.4.4.5. Registry
      5. 5.4.5. Docking Container: Mode
        1. 5.4.5.1. Creating a Mode
        2. 5.4.5.2. Modifying a Mode
      6. 5.4.6. Groups of Windows: TopComponentGroup
        1. 5.4.6.1. Creating a TopComponentGroup
        2. 5.4.6.2. Administration: WindowManager
        3. 5.4.6.3. Window System Architecture
    5. 5.5. Status Bar
      1. 5.5.1. Using the Status Bar
      2. 5.5.2. Extending the Status Bar
    6. 5.6. Progress Bar
      1. 5.6.1. Displaying the Progress of a Task
      2. 5.6.2. Displaying the Progress of Many Related Tasks
      3. 5.6.3. Integrating a Progress Bar into Your Component
    7. 5.7. Summary
  12. 6. Lookup: Let's Talk to Other Modules!
    1. 6.1. Functionality
    2. 6.2. Services and Extension Points
      1. 6.2.1. Defining the Service Interface
      2. 6.2.2. Loose Service Provisioning
      3. 6.2.3. Providing Multiple Service Implementations
      4. 6.2.4. Ensuring Service Availability
    3. 6.3. Global Services
    4. 6.4. Registering Service Providers
      1. 6.4.1. Service Provider Configuration File
        1. 6.4.1.1. Removal of a Service Provider
        2. 6.4.1.2. Order of Service Providers
      2. 6.4.2. Services Folder
    5. 6.5. Intermodule Communication
    6. 6.6. Java Service Loader
    7. 6.7. Summary
  13. 7. File Access and Display: Let's Use the NetBeans Platform to Work with Files!
    1. 7.1. Overview
    2. 7.2. File Systems API
      1. 7.2.1. Operations
        1. 7.2.1.1. Obtaining
        2. 7.2.1.2. Creating
        3. 7.2.1.3. Renaming
        4. 7.2.1.4. Deleting
        5. 7.2.1.5. Moving
        6. 7.2.1.6. Reading and Writing Files
        7. 7.2.1.7. Monitoring Changes
    3. 7.3. Data Systems API
      1. 7.3.1. DataObject
        1. 7.3.1.1. Implementing and Adding Cookies
        2. 7.3.1.2. Using Cookies
        3. 7.3.1.3. Providing Cookies Dynamically
        4. 7.3.1.4. Creating a DataObject Manually
      2. 7.3.2. DataObject Factory
      3. 7.3.3. DataLoader
        1. 7.3.3.1. Implementation
        2. 7.3.3.2. Registration
    4. 7.4. Nodes API
      1. 7.4.1. Node Container
        1. 7.4.1.1. Actions
        2. 7.4.1.2. Event Handling
      2. 7.4.2. Implementing Nodes and Children
    5. 7.5. Explorer & Property Sheet API
    6. 7.6. Summary
  14. 8. Graphical Components: Let's Show Some Interesting Views!
    1. 8.1. Dialogs API
      1. 8.1.1. Standard Dialogs
        1. 8.1.1.1. Information Dialog
        2. 8.1.1.2. Question Dialog
        3. 8.1.1.3. Input Dialog
        4. 8.1.1.4. Error Dialog
      2. 8.1.2. Custom Dialogs
      3. 8.1.3. Wizards
        1. 8.1.3.1. Wizard Architecture
        2. 8.1.3.2. Creating Panels
        3. 8.1.3.3. Creating a Wizard from Panels
        4. 8.1.3.4. Event Handling
        5. 8.1.3.5. Ending a Wizard Prematurely
        6. 8.1.3.6. Final Verification of Data
        7. 8.1.3.7. Iterators
    2. 8.2. MultiViews API
    3. 8.3. Visual Library API
      1. 8.3.1. Structure of the Visual Library API
      2. 8.3.2. The Widget Classes
        1. 8.3.2.1. Dependencies
        2. 8.3.2.2. Border
        3. 8.3.2.3. Layout
          1. 8.3.2.3.1. AbsoluteLayout
          2. 8.3.2.3.2. FlowLayout
          3. 8.3.2.3.3. CardLayout
          4. 8.3.2.3.4. OverlayLayout
      3. 8.3.3. Events and Actions
        1. 8.3.3.1. AcceptAction
        2. 8.3.3.2. ActionMapAction
        3. 8.3.3.3. AddRemoveControlPointAction
        4. 8.3.3.4. MoveAction/AlignWithMoveAction
        5. 8.3.3.5. ResizeAction/AlignWithResizeAction
        6. 8.3.3.6. ZoomAction/CenteredZoomAction
        7. 8.3.3.7. ConnectAction/ExtendedConnectAction/ReconnectAction
        8. 8.3.3.8. CycleFocusAction/CycleObjectSceneFocusAction
        9. 8.3.3.9. EditAction/InplaceEditorAction
        10. 8.3.3.10. ForwardKeyEventsAction
        11. 8.3.3.11. HoverAction
        12. 8.3.3.12. MoveControlPointAction/FreeMoveControlPointAction/OrthogonalMoveControlPointAction
        13. 8.3.3.13. PanAction
        14. 8.3.3.14. PopupMenuAction
        15. 8.3.3.15. SelectAction/RectangularSelectAction
        16. 8.3.3.16. SwitchCardAction
      4. 8.3.4. The Scene: The Root Element
        1. 8.3.4.1. Overview
        2. 8.3.4.2. Exporting a Scene
      5. 8.3.5. ObjectScene: Model-View Relationship
      6. 8.3.6. Graph
      7. 8.3.7. VMD: Visual Mobile Designer
    4. 8.4. Summary
  15. 9. Reusable NetBeans Platform Components: Let's See What We Get for Free!
    1. 9.1. Help System
      1. 9.1.1. Creating and Integrating a Helpset
        1. 9.1.1.1. module-hs.xml
        2. 9.1.1.2. module-map.xml
        3. 9.1.1.3. module-toc.xml
        4. 9.1.1.4. module-idx.xml
        5. 9.1.1.5. Help Topics
      2. 9.1.2. Adding Links to Help Topics
        1. 9.1.2.1. Links to External Sites
        2. 9.1.2.2. Links to Other Help Topics
      3. 9.1.3. Context-Sensitive Help
      4. 9.1.4. Opening the Help System
    2. 9.2. Output Window
    3. 9.3. Navigator
    4. 9.4. Properties Window
      1. 9.4.1. Providing Properties
      2. 9.4.2. User-Defined Properties Editor
    5. 9.5. Options Window
      1. 9.5.1. Providing an Options Panel
        1. 9.5.1.1. View and Controller
        2. 9.5.1.2. Registration
        3. 9.5.1.3. Open Option Panels
      2. 9.5.2. Settings Administration
    6. 9.6. Palette
      1. 9.6.1. Defining and Adding Palette Components via the Layer File
      2. 9.6.2. Creating a Palette from a Node Hierarchy
        1. 9.6.2.1. Node Classes for Creating and Displaying Data
        2. 9.6.2.2. Creating the Palette
        3. 9.6.2.3. Implementing Drag-and-Drop Functionality
    7. 9.7. Summary
  16. 10. Internationalization and Localization: Let's Translate Our Code!
    1. 10.1. String Literals in Source Code
    2. 10.2. String Literals in the Manifest File
    3. 10.3. Internationalization of Help Pages
    4. 10.4. Internationalizing Other Resources
      1. 10.4.1. Graphics
      2. 10.4.2. Any File
      3. 10.4.3. Folders and Files
    5. 10.5. Administration and Preparation of Localized Resources
    6. 10.6. Summary
  17. 11. Real-World Application Development: Let's Understand the Development Cycle!
    1. 11.1. Creation
    2. 11.2. Customization of Platform Modules
    3. 11.3. Customizing the Launcher
    4. 11.4. Distribution
      1. 11.4.1. Distribution As a ZIP Archive
      2. 11.4.2. Distribution via Java Web Start
      3. 11.4.3. Mac OS X Application
    5. 11.5. Summary
  18. 12. Updating a NetBeans Platform Application: Let's Allow the User to Add Features at Runtime!
    1. 12.1. Overview
    2. 12.2. The Auto Update Service
    3. 12.3. The NBM File
    4. 12.4. Update Centers
    5. 12.5. Localized NBM Files
    6. 12.6. Configuring and Installing on the Client
      1. 12.6.1. New Update Center
      2. 12.6.2. Automatically Installing Updates
    7. 12.7. Summary
  19. 13. Persistence: Let's Integrate Some Databases!
    1. 13.1. Java DB
      1. 13.1.1. Integrating Java DB
      2. 13.1.2. Driver Registration
      3. 13.1.3. Creating and Using a Database
      4. 13.1.4. Shutting Down a Database
      5. 13.1.5. Database Development with the Help of the NetBeans IDE
        1. 13.1.5.1. Setting Up and Starting the Java DB System
        2. 13.1.5.2. Integrating the Driver for the Java DB Server into Your Application
        3. 13.1.5.3. Setting Up and Configuring the Database
        4. 13.1.5.4. Access to a Database from Your Application
        5. 13.1.5.5. Creating and Importing Table Structures
      6. 13.1.6. Example Application
        1. 13.1.6.1. Configuration, Access, and Shutdown
        2. 13.1.6.2. Data Models and Data Access Models
        3. 13.1.6.3. Displaying and Working with the Data
    2. 13.2. Hibernate
      1. 13.2.1. Setting Up the Hibernate Libraries
      2. 13.2.2. Structure of the Example Application
      3. 13.2.3. Configuring Hibernate
      4. 13.2.4. Mapping Objects to Relations
      5. 13.2.5. SessionFactory and Sessions
      6. 13.2.6. Saving and Loading Objects
    3. 13.3. Java Persistence API
      1. 13.3.1. Hibernate and the Java Persistence API
      2. 13.3.2. Java Persistence Configuration
      3. 13.3.3. Entity Classes
      4. 13.3.4. EntityManagerFactory and EntityManager
      5. 13.3.5. Saving and Loading Objects
    4. 13.4. Summary
  20. 14. Web Services: Let's Integrate the Web!
    1. 14.1. Creating a Web Service Client
    2. 14.2. Using a Web Service
    3. 14.3. Summary
  21. 15. Extending the NetBeans IDE: Let's Add Some Features to the NetBeans IDE!
    1. 15.1. Palettes
      1. 15.1.1. Defining and Registering Palette Entries
      2. 15.1.2. Creating and Registering a PaletteController
      3. 15.1.3. Expanding Existing Palettes
    2. 15.2. Task List API
    3. 15.3. Summary
  22. 16. From Eclipse RCP to the NetBeans Platform: Let's Abandon SWT!
    1. 16.1. The NetBeans IDE
      1. 16.1.1. Standard Components
      2. 16.1.2. Handling Projects
    2. 16.2. From Eclipse Plugins to NetBeans Modules
      1. 16.2.1. Plugin: Lifecycle and Events
      2. 16.2.2. Plugin Information
      3. 16.2.3. Images
      4. 16.2.4. Resources
      5. 16.2.5. Settings
      6. 16.2.6. Application Lifecycle
      7. 16.2.7. Views and Editors
    3. 16.3. Summary
  23. 17. Tips and Tricks: Let's Get Some Cool Expert Tips!
    1. 17.1. Asynchronous Initialization of Graphic Components
    2. 17.2. Undo/Redo
    3. 17.3. Ending an Application's Lifecycle
    4. 17.4. WarmUp Tasks
    5. 17.5. System Tray
    6. 17.6. Desktop
    7. 17.7. Logging
      1. 17.7.1. Logger
      2. 17.7.2. LogManager
      3. 17.7.3. Configuration
      4. 17.7.4. Error Reports
    8. 17.8. Summary
  24. 18. Example: MP3 Manager: Let's Put It All Together!
    1. 18.1. Design
    2. 18.2. Creating the NetBeans Platform Application
    3. 18.3. Support for MP3
      1. 18.3.1. Creating the JMF Module
      2. 18.3.2. Registering the MP3 Plugin
      3. 18.3.3. MP3 File Type
    4. 18.4. ID3 Support
      1. 18.4.1. ID3 API
      2. 18.4.2. ID3 Editor
    5. 18.5. Media Library
    6. 18.6. Services
    7. 18.7. MP3 Player
      1. 18.7.1. Service Interface
      2. 18.7.2. Service Provider
      3. 18.7.3. Playback of MP3 Files
      4. 18.7.4. User Interface
    8. 18.8. Playlist
      1. 18.8.1. Node View
      2. 18.8.2. Node Container
      3. 18.8.3. TopComponent
      4. 18.8.4. Drag-and-Drop
      5. 18.8.5. Saving the Playlist
    9. 18.9. Summary
  25. A. Important NetBeans Extension Points and Configuration DTDs