My TopComponent always opens in the editor area, but I want it to open in the same place as XYZ?
By default, TopComponent.open()
opens all components in the central editor area of the
main window. Overriding this is simple:
public MyTopComponent extends TopComponent {
public void open() {
Mode m = WindowManager.getDefault().findMode ("output");
if (m != null) {
m.dockInto(this);
}
super.open();
}
}
You need to know the ID of the Mode you want to put the component in. Common IDs are "output" for the bottom of the screen, and "explorer" for the left side. For other Modes, you may need to find a module that puts something there and read its layer files, or browse the System Filesystem.
Eventually you will probably want to specify what mode to dock your component into using the XML API for installing components, but the above technique works for simple modules, testing, etc.