What is the Window System?

Apache NetBeans Wiki Index

Note: These pages are being reviewed.

The windowing system is what creates the main application window, and makes it possible to open components in the UI. The API for the windowing system is in the package org.openide.windows. The implementation of the windowing system is in the module org.netbeans.core.windows (core.windows in Mercurial repository, was core/windows in CVS).

The window system defines Modes which are places in the main window occupied by tabbed containers. TopComponents are GUI components (instances or subclasses of org.openide.windows.TopComponent which can be put into these tabbed containers.

There is a programmatic API for creating/opening TopComponents - this is useful for testing components under development - just create an Action which calls new MyTopComponent().open() to quickly try out GUI components.

However, the main API modules use the declarative XML Window System API to install their components, for the following reasons:

  • Scalability: Components do not need to be created/deserialized unless they really need to be opened

  • Singletonization: You wouldn’t want to have 5 Projects tabs in the IDE. Using the XML API correctly, you can easily refer to the singleton instance of your component once it’s instantiated (almost) for free.

  • Persistence: The window system associates components with unique IDs; to properly persist your component across sessions, you need to use the XML APIs