As explained in Section 12.1, “Special Characteristics of AJAX Applications”, an AJAX web application usually runs in a single "web page" in a browser window. The page is generally not reloaded after it is opened initially, but it communicates user interaction with the server through AJAX communications. A window in an AJAX application is therefore more like a window in a desktop application and less like a web page.

A Window is the top-level container of a user interface displayed in a browser window. As an AJAX application typically runs on a single "page" (URL), there is usually just one window -- the main window. The main window can be accessed using the URL of the application. You set the main window with the setMainWindow() method of the Application class.

import com.vaadin.ui.*;

public class HelloWorld extends com.vaadin.Application {
    public void init() { 
        Window main = new Window("The Main Window"); 
        setMainWindow(main);

        ... fill the main window with components ...
    }
}

You can add components to the main window, or to any other window, with the addComponent() method, which actually adds the given component to the root layout component bound to the window. If you wish to use other than the default root layout, you can set it with setContent(), as explained in Section 6.2, “Window and Panel Root Layout”.

Vaadin has two basic kinds of windows: application-level windows, such as the main window, and sub-windows inside the application-level windows. The sub-windows are explained in the next section, while application-level windows are covered in Section 12.2, “Application-Level Windows”.