| // |
| // Licensed to the Apache Software Foundation (ASF) under one |
| // or more contributor license agreements. See the NOTICE file |
| // distributed with this work for additional information |
| // regarding copyright ownership. The ASF licenses this file |
| // to you under the Apache License, Version 2.0 (the |
| // "License"); you may not use this file except in compliance |
| // with the License. You may obtain a copy of the License at |
| // |
| // http://www.apache.org/licenses/LICENSE-2.0 |
| // |
| // Unless required by applicable law or agreed to in writing, |
| // software distributed under the License is distributed on an |
| // "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY |
| // KIND, either express or implied. See the License for the |
| // specific language governing permissions and limitations |
| // under the License. |
| // |
| |
| = DevFaqWindowsTopComponent |
| :jbake-type: wiki |
| :jbake-tags: wiki, devfaq, needsreview |
| :jbake-status: published |
| :keywords: Apache NetBeans wiki DevFaqWindowsTopComponent |
| :description: Apache NetBeans wiki DevFaqWindowsTopComponent |
| :toc: left |
| :toc-title: |
| :syntax: true |
| |
| === What is a TopComponent in the Window System? |
| |
| [link:http://bits.netbeans.org/dev/javadoc/org-openide-windows/org/openide/windows/TopComponent.html[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 link:DevFaqWindowsMode.asciidoc[Mode]s - 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 link:DevFaqWindowsMode.asciidoc[Mode] |
| * *active/inactive* - When a TopComponent is _active_, it or a child component of it has keyboard focus, and it is currently the global link:DevFaqTrackGlobalSelection.asciidoc[selection context] |
| |
| Each `TopComponent` has a `link:DevFaqLookup.asciidoc[Lookup]` and one or more `link:DevFaqWhatIsANode.asciidoc[activated Node]`s. These define the link:DevFaqTrackGlobalSelection.asciidoc[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 link:http://bits.netbeans.org/dev/javadoc/org-openide-windows/org/openide/windows/doc-files/api.html[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 link:DevFaqWindowsInternals.asciidoc[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 link:http://wiki.netbeans.org/DevFaqWindowsTopComponent[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-02-07, and needs to be reviewed. |