org.eclipse.swt.widgets.Shell.getImages()方法的使用及代码示例

x33g5p2x  于2022-01-29 转载在 其他  
字(1.9k)|赞(0)|评价(0)|浏览(94)

本文整理了Java中org.eclipse.swt.widgets.Shell.getImages()方法的一些代码示例,展示了Shell.getImages()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Shell.getImages()方法的具体详情如下:
包路径:org.eclipse.swt.widgets.Shell
类名称:Shell
方法名:getImages

Shell.getImages介绍

暂无

代码示例

代码示例来源:origin: org.eclipse.rap/org.eclipse.rap.rwt

private static void renderImage( Shell shell ) {
 if( ( shell.getStyle() & SWT.TITLE ) != 0 ) {
  Image image = shell.getImage();
  if( image == null ) {
   Image[] defaultImages = shell.getImages();
   if( defaultImages.length > 0 ) {
    image = defaultImages[0];
   }
  }
  renderProperty( shell, PROP_IMAGE, image, null );
 }
}

代码示例来源:origin: org.eclipse.rap/org.eclipse.rap.rwt.q07

private static void writeImage( final Shell shell ) throws IOException {
 if( ( shell.getStyle() & SWT.TITLE ) != 0 ) {
  Image image = shell.getImage();
  if( image == null ) {
   Image[] defaultImages = shell.getImages();
   if( defaultImages.length > 0 ) {
    image = defaultImages[0];
   }
  }
  if( WidgetLCAUtil.hasChanged( shell, PROP_IMAGE, image, null ) ) {
   JSWriter writer = JSWriter.getWriterFor( shell );
   writer.set( JSConst.QX_FIELD_ICON,
         ImageFactory.getImagePath( image ) );
  }
 }
}

代码示例来源:origin: org.eclipse.mylyn.commons/workbench

public static Image getWorkbenchShellImage(int maximumHeight) {
  // always use the launching workbench window
  IWorkbenchWindow[] windows = PlatformUI.getWorkbench().getWorkbenchWindows();
  if (windows != null && windows.length > 0) {
    IWorkbenchWindow workbenchWindow = windows[0];
    if (workbenchWindow != null && !workbenchWindow.getShell().isDisposed()) {
      Image image = getShell().getImage();
      int diff = Integer.MAX_VALUE;
      if (image != null && image.getBounds().height <= maximumHeight) {
        diff = maximumHeight - image.getBounds().height;
      } else {
        image = null;
      }
      Image[] images = getShell().getImages();
      if (images != null && images.length > 0) {
        // find the icon that is closest in size, but not larger than maximumHeight 
        for (Image image2 : images) {
          int newDiff = maximumHeight - image2.getBounds().height;
          if (newDiff >= 0 && newDiff <= diff) {
            diff = newDiff;
            image = image2;
          }
        }
      }
      return image;
    }
  }
  return null;
}

相关文章

微信公众号

最新文章

更多

Shell类方法