次のように、タブではなく「エディタ」モードで2つのTopComponentsのデフォルト位置を設定するにはどうすればよいですか。
しかし、互いに隣り合っています。このような:
?
この問題を解決するための鍵は、同じ望ましい種類の「エディター」、同じ垂直方向と水平方向の「重み」、異なる水平方向の「数値」を使用して、2つの新しい異なるモードを作成することでした。方法は次のとおりです。
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に2つの.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を簡単に再配置することで、オブジェクトが永続的に上書きされます。