Netbeans自定义mode

1 在模块根目录下编辑mode文件,例如chatEditor.wsmode

<?xml version="1.0" encoding="UTF-8"?>

<!DOCTYPE mode PUBLIC
          "-//NetBeans//DTD Mode Properties 2.1//EN"
          "http://www.netbeans.org/dtds/mode-properties2_1.dtd">

<mode version="2.1">
    <name unique="chatEditor" />
    <kind type="editor" />
    <state type="separated" />
    <bounds x="50" y="50" width="536" height="436" />
    <constraints>
    </constraints>
    <empty-behavior permanent="true" />
</mode>

2 在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="chatEditor.wsmode" url="chatEditor.wsmode"/>
        </folder>
    </folder>
</filesystem>

3 调用

Mode mode = TCManager.getChatEditorMode();
if(mode != null) {
    mode.dockInto(win);
}
win.setName(name);   // 必须在EDT线程调用
if (!win.isOpened()) {
    win.open();
}
原文地址:https://www.cnblogs.com/cuizhf/p/2216337.html