blob: e6558f69dbcb98ddd6e5dc9f8087c6b2eaeb4f42 [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.
//
= DevFaqInitialMainWindowSize
:jbake-type: wiki
:jbake-tags: wiki, devfaq, needsreview
:jbake-status: published
:keywords: Apache NetBeans wiki DevFaqInitialMainWindowSize
:description: Apache NetBeans wiki DevFaqInitialMainWindowSize
:toc: left
:toc-title:
:syntax: true
==== How do I adjust the initial size/position of the main window?
The default initial size of an application based on NetBeans platform is 90% of the whole screen area and the main window is also centered. These defaults can be redefined quite easily:
* make sure your module has implementation dependency on Core - Windows module, when using NetBeans 6.9 you can use 'weight' attribute instead of implementation dependency.
* copy file _WindowManager.wswmgr_ from Core - Windows module into the source folder of your own module (you'll find it in folder _core.windows\src\org\netbeans\core\windows\resources\windowmanager_)
* reference the copied file in your module's XML Layer:
[source,xml]
----
<folder name="Windows2">
<file name="WindowManager.wswmgr" url="WindowManager.wswmgr"/>
</folder>
----
* now you can specify either size relative to the size of the whole screen area (the main window will be centered then) which will work on any screen resolution:
[source,xml]
----
<main-window>
<joined-properties centered-horizontally="true" centered-vertically="true"
relative-width="0.5" relative-height="0.5" />
<separated-properties centered-horizontally="true" relative-y="0.1"
relative-width="0.8" relative-height="0.08" />
</main-window>
----
The snippet from _windowmanager.wswmgr_ above makes the default main window size to be half of the whole screen area.
* or you can specify exact size and location in pixels:
[source,xml]
----
<main-window>
<joined-properties x="0" y="0" width="800" height="600"
relative-x="0.0" relative-y="0.0" relative-width="0.0" relative-height="0.0" centered-horizontally="false" centered-vertically="false"
maximize-if-width-below="0" maximize-if-height-below="0" frame-state="6"/>
<separated-properties x="160" y="116" width="1280" height="93"
relative-x="0.0" relative-y="0.0" relative-width="0.0" relative-height="0.0" centered-horizontally="false" centered-vertically="false" frame-state="0" />
</main-window>
----
The snippet from _windowmanager.wswmgr_ above opens the main window in the upper left corner of the screen and makes its size 800x600 pixels.
* you can safely ignore _separated-properties_ part, those properties were used for SDI mode which is no longer supported.
* keep the rest of _windowmanager.wswmgr_ as it was
*Note:* This way you can also define the default main window state - maximized/minimized/restored, see link:http://java.sun.com/j2se/1.5.0/docs/api/java/awt/Frame.html#setExtendedState(int)[JavaDoc] for possible values.
=== 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/DevFaqInitialMainWindowSize[http://wiki.netbeans.org/DevFaqInitialMainWindowSize] ,
that was last modified by NetBeans user Simpatico
on 2010-11-02T01:43:02Z.
*NOTE:* This document was automatically converted to the AsciiDoc format on 2018-02-07, and needs to be reviewed.