blob: 8cf5f64afdc34e85d11c25e38cae970975b2928b [file] [log] [blame]
//
// 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.
//
= DevFaqWindowsOpenInMode
:jbake-type: wiki
:jbake-tags: wiki, devfaq, needsreview
:jbake-status: published
:keywords: Apache NetBeans wiki DevFaqWindowsOpenInMode
:description: Apache NetBeans wiki DevFaqWindowsOpenInMode
:toc: left
:toc-title:
:syntax: true
=== My TopComponent always opens in the editor area, but I want it to open in the same place as XYZ?
By default, `TopComponent.open()` opens all components in the central editor area of the
main window. Overriding this is simple:
[source,java]
----
public MyTopComponent extends TopComponent {
public void open() {
Mode m = WindowManager.getDefault().findMode ("output");
if (m != null) {
m.dockInto(this);
}
super.open();
}
}
----
You need to know the ID of the link:DevFaqWindowsMode.asciidoc[Mode ] you want to put the component in. Common IDs are "output" for the bottom of the screen, and "explorer" for the left side. For other Modes, you may need to find a module that puts something there and read its layer files, or link:DevFaqFilesystemSee.asciidoc[browse] the link:DevFaqSystemFilesystem.asciidoc[System Filesystem].
Eventually you will probably want to specify what mode to dock your component into using the link:DevFaqWindowsXmlApi.asciidoc[XML API for installing components], but the above technique works for simple modules, testing, etc.
=== 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/DevFaqWindowsOpenInMode[http://wiki.netbeans.org/DevFaqWindowsOpenInMode] ,
that was last modified by NetBeans user Admin
on 2009-11-06T16:06:12Z.
*NOTE:* This document was automatically converted to the AsciiDoc format on 2018-02-07, and needs to be reviewed.