for (ToolWindow window : toolWindowManager.getToolWindows())
window.setAvailable(true);
// Create two groups
ToolWindowGroup mainGroup = toolWindowManager.getToolWindowGroup("Main");
ToolWindowGroup submainGroup = toolWindowManager.getToolWindowGroup("SubMain");
// Set TypeDescriptor properties for tool window 1
ToolWindow toolWindow = toolWindowManager.getToolWindow("1");
DockedTypeDescriptor dockedTypeDescriptor = (DockedTypeDescriptor) toolWindow.getTypeDescriptor(ToolWindowType.DOCKED);
dockedTypeDescriptor.setPopupMenuEnabled(false);
dockedTypeDescriptor.setDockLength(300);
mainGroup.addToolWindow(toolWindow);
// Set properties for tool window 2
toolWindow = toolWindowManager.getToolWindow("2");
dockedTypeDescriptor = (DockedTypeDescriptor) toolWindow.getTypeDescriptor(ToolWindowType.DOCKED);
dockedTypeDescriptor.getToolsMenu().add(new JMenuItem("Prova"));
toolWindow.setType(ToolWindowType.FLOATING_FREE);
FloatingTypeDescriptor descriptor = (FloatingTypeDescriptor) toolWindow.getTypeDescriptor(ToolWindowType.FLOATING_FREE);
descriptor.setLocation(100, 100);
descriptor.setSize(250, 250);
submainGroup.addToolWindow(toolWindow);
toolWindow = toolWindowManager.getToolWindow("3");
dockedTypeDescriptor = (DockedTypeDescriptor) toolWindow.getTypeDescriptor(ToolWindowType.DOCKED);
JMenuItem menuItem = new JMenuItem("Hello World!!!");
menuItem.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
JOptionPane.showMessageDialog(frame, "Hello World!!!");
}
});
dockedTypeDescriptor.getToolsMenu().add(menuItem);
mainGroup.addToolWindow(toolWindow);
// Set properties for tool window 4
toolWindow = toolWindowManager.getToolWindow("4");
toolWindow.setType(ToolWindowType.FLOATING_FREE);
submainGroup.addToolWindow(toolWindow);
// Set properties for tool window 5
toolWindow = toolWindowManager.getToolWindow("5");
toolWindow.setType(ToolWindowType.FLOATING_FREE);
submainGroup.addToolWindow(toolWindowManager.getToolWindow("6"));
// Set properties for tool window 7
toolWindow = toolWindowManager.getToolWindow("7");
toolWindow.setType(ToolWindowType.FLOATING);