Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Netbeans Platform Layout

I have designed a little application using netbeans platform and now i want to change the orientation of the basic layout provided by netbeans platform. I have a window displaying like this shown below enter image description here

I want the abouve screen to be displayed like below on the startup. I have resized to suit my needs but i want that to happen by itself.

enter image description here

After intense googling i found that i need to create a layer.xml in one of the module and add the following code to it.

<folder name="Windows2"> <file name="WindowManager.wswmgr" url="WindowManager.wswmgr"/> </folder>

My WindowManager.wswmgr file looks like this

<windowmanager version="2.1">
<main-window> 
    <joined-properties centered-horizontally="true" centered-vertically="true"
                       width="630" height="400" />
    <separated-properties centered-horizontally="true" relative-y="0.1"
                       relative-width="0.6" relative-height="0.08" />
</main-window>
<editor-area state="joined">
    <constraints>
        <path orientation="horizontal" number="60" weight="0.5" />
        <path orientation="vertical" number="40" weight="0.7" /> 
        <path orientation="horizontal" number="40" weight="0.5" /> 
    </constraints>
    <relative-bounds x="33" y="24" width="42" height="44"/>
</editor-area>
<screen width="1024" height="800" />
<active-mode name="explorer" />
<maximized-mode name="" />
<toolbar configuration="Standard" preferred-icon-size="24" />

What do i have to do now? Am I missing some obvious things ??

--EDIT--

layer.xml

<filesystem>
<folder name="Actions">
    <folder name="Window">
        <file name="org-choose-transaction-ChooseTransactionTopComponent.instance_hidden"/>
        <file name="org-choose-transaction-EnterAmountTopComponent.instance">
            <attr name="instanceCreate" methodvalue="org.openide.windows.TopComponent.openAction"/>
            <attr name="preferredID" stringvalue="ChooseTransactionTopComponent"/>
        </file>
        <file name="org-prowze-maketransaction-TransactionTopComponent.instance">
            <attr name="instanceCreate" methodvalue="org.openide.windows.TopComponent.openAction"/>
            <attr name="preferredID" stringvalue="transactionTopComponent"/>
        </file>
        <file name="org-prowze-maketransaction-transactionTopComponent.instance_hidden"/>
    </folder>
</folder>
<folder name="Toolbars_hidden"/>

<folder name="Windows2">
    <folder name="Modes">
        <file name="explorer.wsmode" url="explorer.wsmode"/>
        <folder name="explorer"/>
    </folder>   
    <file name="WindowManager.wswmgr" url="WindowManager.wswmgr"/>
</folder>

explorer.wsmode

<mode version="2.4">
<module name="org.netbeans.core.ui/1" spec="1.2" />
<name unique="explorer"  />
<kind type="view" />
<state type="joined"  />
<constraints>
    <path orientation="horizontal" number="20" weight="0.3"/>
    <path orientation="vertical" number="20" weight="0.5"/>
</constraints>
<bounds x="192" y="228" width="614" height="520" />
<frame state="0"/>
<active-tc  id="CustomerViewerTopComponent" />
<empty-behavior permanent="true"/></mode>
like image 944
Deepak Avatar asked Apr 27 '12 04:04

Deepak


People also ask

How do I change the default platform in NetBeans?

If you want to change the default one, you need to go the path C:\Program Files\NetBeans 8.2\etc and you need to change the netbeans. conf file. Change the path to your wanted JDK and you're finished.

How does NetBeans platform work?

Netbeans is an open-source Integrated Development Environment (IDE). It is used to develop applications with Java, PHP, C++, HTML and many other programming languages. The applications are developed using modules in Java. NetBeans can run on any operating system such as Windows, MacOS, Linux etc.

Where is platform manager in NetBeans?

Managing Platforms in NetBeans IDE To access the Java Platform Manager do one of the following: On the Tools menu, select Java Platforms. When creating a project, click Manage Platforms. In the Platform category of the Project Properties window for an existing project, click Manage Platforms.

What is NetBeans platform application?

What is the NetBeans Platform? The NetBeans Platform is a broad Java framework on which you can base large desktop applications. NetBeans IDE itself is one of the hundreds of applications based on the NetBeans Platform.


1 Answers

The WindowManager.wswmgr file defines the main window's attributes. The other piece that you need to define is the explorer mode (assuming that the CustomerViewer Window is in the explorer mode).

Defining and registering a mode is similar to how you've defined and registered the WindowManager.wswmgr file. The pragmatic way¹ of determining what the xml should look like is to run the application, move the divider to the desired position, close the application, and open the following file from the Files explorer<Your_NB_Application>/build/testuserdir/config/Windows2Local/Modes/explorer.wsmode.

Copy the contents from the explorer.wsmode into a file named explorer.wsmode which you can create in the module's root package (com.example.mymodule). Now you need to register this file in your layer file:

<folder name="Windows2"> 
    <file name="WindowManager.wswmgr" url="WindowManager.wswmgr"/> 
    <folder name="Modes">
        <file name="explorer.wsmode" url="explorer.wsmode"/>
        <folder name="explorer"/>
    </folder>        
</folder>

Be sure to run "Clean and Build All" on your application before running it again.

¹The formal way for determining the structure is to use the dtd located at http://www.netbeans.org/dtds/mode-properties2_4.dtd

like image 89
Jonathan Spooner Avatar answered Oct 17 '22 01:10

Jonathan Spooner