/** * Sets the window's icon by URL. * <p> * If the icon already exists in the application context resource cache, * the cached value will be used. Otherwise, the icon will be loaded * synchronously and added to the cache. * * @param iconURL * The location of the icon to set. */ public void setIcon(URL iconURL) { if (iconURL == null) { throw new IllegalArgumentException("iconURL is null."); } Image icon = Image.loadFromCache(iconURL); getIcons().remove(0, getIcons().getLength()); getIcons().add(icon); }
/** * Sets the window's icon by URL. * <p> * If the icon already exists in the application context resource cache, * the cached value will be used. Otherwise, the icon will be loaded * synchronously and added to the cache. * * @param iconURL * The location of the icon to set. */ public void setIcon(URL iconURL) { if (iconURL == null) { throw new IllegalArgumentException("iconURL is null."); } Image icon = (Image)ApplicationContext.getResourceCache().get(iconURL); if (icon == null) { try { icon = Image.load(iconURL); } catch (TaskExecutionException exception) { throw new IllegalArgumentException(exception); } ApplicationContext.getResourceCache().put(iconURL, icon); } getIcons().remove(0, getIcons().getLength()); getIcons().add(icon); }
@Override public void run() { java.awt.Window hostWindow = getDisplay().getHostWindow(); if (DesktopDisplayHost.this.rootOwner == null) { ((TitledWindow)hostWindow).setTitle(DEFAULT_HOST_WINDOW_TITLE); hostWindow.setIconImage(null); } else { ((TitledWindow)hostWindow).setTitle(DesktopDisplayHost.this.rootOwner.getTitle()); java.util.ArrayList<BufferedImage> iconImages = new java.util.ArrayList<BufferedImage>(); for (Image icon : DesktopDisplayHost.this.rootOwner.getIcons()) { if (icon instanceof Picture) { iconImages.add(((Picture) icon).getBufferedImage()); } } if (iconImages.size() == 1) { hostWindow.setIconImage(iconImages.get(0)); } else if (iconImages.size() > 1) { hostWindow.setIconImages(iconImages); } } updateHostWindowTitleBarCallback = null; } };
@Override public void run() { java.awt.Window hostWindow = getDisplay().getHostWindow(); if (DesktopDisplayHost.this.rootOwner == null) { ((TitledWindow)hostWindow).setTitle(DEFAULT_HOST_WINDOW_TITLE); hostWindow.setIconImage(null); } else { ((TitledWindow)hostWindow).setTitle(DesktopDisplayHost.this.rootOwner.getTitle()); java.util.ArrayList<BufferedImage> iconImages = new java.util.ArrayList<BufferedImage>(); for (Image icon : DesktopDisplayHost.this.rootOwner.getIcons()) { if (icon instanceof Picture) { iconImages.add(((Picture) icon).getBufferedImage()); } } if (iconImages.size() == 1) { hostWindow.setIconImage(iconImages.get(0)); } else if (iconImages.size() > 1) { hostWindow.setIconImages(iconImages); } } DesktopDisplayHost.this.updateHostWindowTitleBarCallback = null; } };