Closing a Child Window
// Create a sub-window and add it to the main window
Window sub = new Window("Close Me");
mainWindow.addWindow(sub);
// Center the sub-window in the application-level window
sub.center();
// Handle closing of the window by user
sub.addListener(new CloseListener() {
public void windowClose(CloseEvent e) {
layout.addComponent(new Label("Sub-window of "+
mainWindow.getCaption() + " was closed"));
}
});