解決這個問題的關鍵是創建兩個新的不同模式,具有相同的所需類型的「編輯器」,相同的垂直和水平「權重」,但不同的水平「數字」。這裏是如何:
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輕鬆地覆蓋。
我不確定,但我認爲這個問題及其答案可能對您有用http://stackoverflow.com/q/2397991/613495 – Boro
以下博客可能會對您有所幫助https://blogs.oracle。 COM/geertjan /項/ creating_a_new_split_in –