繁体   English   中英

NetBeans平台默认的TopComponent定位为anonymousMode_1

[英]NetBeans platform default TopComponent positioning as anonymousMode_1

如何在“编辑器”模式下(而不是在标签页中)设置两个TopComponents的默认位置,如下所示:

标签式的http://www.pasteall.org/pic/show.php?id=31021

但彼此相邻; 像这样:

平移http://www.pasteall.org/pic/show.php?id=31022

解决此问题的关键是创建两个新的不同模式,它们具有相同的所需种类的“编辑器”,相同的垂直和水平“权重”,但具有不同的水平“数”。 方法如下:

Mp3PaneLeft.wsmode

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mode PUBLIC "-//NetBeans//DTD Mode Properties 2.3//EN" "http://www.netbeans.org/dtds/mode-properties2_3.dtd">
<mode version="2.3">
    <name  unique="Mp3PaneLeft" />
    <kind  type="editor" />
    <state type="joined" />
    <constraints>
        <path orientation="vertical" number="20" weight="0.2"/>
        <path orientation="horizontal" number="20" weight="0.5"/>
    </constraints>
    <empty-behavior permanent="true" />
</mode>

Mp3PaneRight.wsmode

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mode PUBLIC "-//NetBeans//DTD Mode Properties 2.3//EN" "http://www.netbeans.org/dtds/mode-properties2_3.dtd">
<mode version="2.3">
    <name  unique="Mp3PaneRight" />
    <kind  type="editor" />
    <state type="joined" />
    <constraints>
        <path orientation="vertical" number="20" weight="0.2"/>
        <path orientation="horizontal" number="40" weight="0.5"/>
    </constraints>
    <empty-behavior permanent="true" />
</mode>

这是layer.xml中两个.wsmodes的注册:

layer.xml

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE filesystem PUBLIC "-//NetBeans//DTD Filesystem 1.2//EN" "http://www.netbeans.org/dtds/filesystem-1_2.dtd">
<filesystem>
    <folder name="Windows2">
        <folder name="Modes">
            <file name="Mp3PaneLeft.wsmode" url="Mp3PaneLeft.wsmode"/>
            <file name="Mp3PaneRight.wsmode" url="Mp3PaneRight.wsmode"/>
        </folder>
    </folder>
</filesystem>

现在可以使用

@TopComponent.Registration(mode = "Mp3PaneLeft", openAtStartup = true, position = 10)

@TopComponent.Registration(mode = "Mp3PaneRight", openAtStartup = true,position = 20)

左侧和右侧TopComponent窗格的注释。

另外,每次更改此默认值时,也不要忘记清理生成的对象-用户对TopComponents的重新定位很容易使它们永久被覆盖。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM