Question

I created module in netBean platform, then I created window component there, and I want to specify default position in main window. For exapmle position "editor". Where I can do it?

Was it helpful?

Solution

It does not look like the NB WindowManager has a way to specify a position for a window in a manner similar to what you are asking. The screen is broken up into areas (known as modes) and there are methods that let you position a window/TopComponent into a mode.

There is a document that provides a good overview of the NB windowing system. It has links to more detailed info that will help you.

Edit:

Another strategy to use to reposition a window is to edit the layer file associated with your module. This file is usually called 'layer.xml'.

Look for an entry like the following

<folder name="Windows2">
    <folder name="Components">
        <file name="MyEditorWindowTopComponent.settings" url="MyEditorWindowTopComponentSettings.xml"/>
    </folder>
    <folder name="Modes">
        <folder name="editor">
            <file name="MyEditorWindowTopComponent.wstcref" url="MyEditorWindowTopComponentWstcref.xml"/>
        </folder>
    </folder>
</folder>

Change the name of the subfolder under "Modes" to match the value that you want as the new position/mode...

OTHER TIPS

Under NetBeans 7, to change from 'output' position to 'editor' position:

In your Window class, change the annotation

@TopComponent.Registration(mode="output", openAtStartup = true)

to

@TopComponent.Registration(mode="editor", openAtStartup = true)

Then you need to clean and rebuild. If you don't clean it, it won't pick up the changes for some reason - probably caching.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top