Skip to content

DevFaqWindowsTopComponent

Antonio Vieiro edited this page Jan 25, 2018 · 1 revision

DevFaqWindowsTopComponent

What is a TopComponent in the Window System?

[http://bits.netbeans.org/dev/javadoc/org-openide-windows/org/openide/windows/TopComponent.html org.openide.windows.TopComponent] is a JComponent subclass which knows how to work with the NetBeans window system. If you want to add components to the main window, typically you will subclass TopComponent, using it the same way you would a JPanel.

TopComponents live inside Modes - docking containers.

TopComponents can have various states:

  • open/closed - When a TopComponent is open, a tab exists somewhere in the main window or UI for it

  • visible/invisible - When a TopComponent is visible, it is the selected tab in its Mode

  • active/inactive - When a TopComponent is active, it or a child component of it has keyboard focus, and it is currently the global selection context

Each TopComponent has a Lookup and one or more `activated Node`s. These define the selection context for the window system, which determines what actions (menu items, toolbar buttons, etc.) are enabled, and in some cases, what they will do or operate on if invoked.

`TopComponent`s are part of the Windows API.

TopComponents that were already open may be deserialized and reopened on restart. The template that NetBeans 5.0 provides includes code for this - it is actually using saved using the Externalizable interface. Whether or not it is saved is determined by what you return from getPersistenceType().

For information on how and when these are reconstructed on startup, see the gory details of the window system on startup.

Apache Migration Information

The content in this page was kindly donated by Oracle Corp. to the Apache Software Foundation.

This page was exported from http://wiki.netbeans.org/DevFaqWindowsTopComponent , that was last modified by NetBeans user Tboudreau on 2010-02-25T16:18:58Z.

NOTE: This document was automatically converted to the AsciiDoc format on 2018-01-26, and needs to be reviewed.

Clone this wiki locally