this.name = name; if (isAttached()) { throw new IllegalStateException( "Window name can not be changed while "
/** * Sets the main window of this application. Setting window as a main window * of this application also adds the window to this application. * * @param mainWindow * the UI to set as the default window */ public void setMainWindow(LegacyWindow mainWindow) { if (this.mainWindow != null) { throw new IllegalStateException("mainWindow has already been set"); } if (mainWindow.isAttached()) { throw new IllegalStateException( "mainWindow is attached to another application"); } if (UI.getCurrent() == null) { // Assume setting a main window from Application.init if there's // no current UI -> set the main window as the current UI UI.setCurrent(mainWindow); } addWindow(mainWindow); this.mainWindow = mainWindow; }