当前位置: 首页>>代码示例>>Java>>正文


Java Image类代码示例

本文整理汇总了Java中org.eclipse.swt.graphics.Image的典型用法代码示例。如果您正苦于以下问题:Java Image类的具体用法?Java Image怎么用?Java Image使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


Image类属于org.eclipse.swt.graphics包,在下文中一共展示了Image类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: HydrographCompletionProposal

import org.eclipse.swt.graphics.Image; //导入依赖的package包/类
public HydrographCompletionProposal(String replacementString, int replacementOffset, int replacementLength, int cursorPosition,
        Image image, String displayString, IContextInformation contextInformation, String additionalProposalInfo) {
    Assert.isNotNull(replacementString);
    Assert.isTrue(replacementOffset >= 0);
    Assert.isTrue(replacementLength >= 0);
    Assert.isTrue(cursorPosition >= 0);

    fReplacementString = replacementString;
    fReplacementOffset = replacementOffset;
    fReplacementLength = replacementLength;
    fCursorPosition = cursorPosition;
    fImage = image;
    fDisplayString = displayString;
    fContextInformation = contextInformation;
    fAdditionalProposalInfo = additionalProposalInfo;
}
 
开发者ID:capitalone,项目名称:Hydrograph,代码行数:17,代码来源:HydrographCompletionProposal.java

示例2: getImage

import org.eclipse.swt.graphics.Image; //导入依赖的package包/类
@Override
public Image getImage(final Object element) {

	if (element instanceof WorkingSet) {
		return decorator.decorateImage(WORKING_SET_IMG, element);
	}

	// (temporarily) disabled because #isSourceFolder() and #isOutputFolder() obtain a lock on the workspace
	// (e.g. they call IResource#exists() on IFolder 'element') and this seems to cause performance issues with
	// locks that egit is obtaining for doing cyclic updates (see IDE-2269):

	// if (element instanceof IFolder) {
	// final IFolder folder = (IFolder) element;
	// if (helper.isSourceFolder(folder) || helper.isOutputFolder(folder)) {
	// return decorator.decorateImage(SRC_FOLDER_IMG, element);
	// }
	// }

	return delegate.getImage(element);
}
 
开发者ID:eclipse,项目名称:n4js,代码行数:21,代码来源:N4JSProjectExplorerLabelProvider.java

示例3: getImage

import org.eclipse.swt.graphics.Image; //导入依赖的package包/类
/**
 * Get image by path from image registry. If not already registered a new
 * image will be created and registered. If not createable a fallback image
 * is used instead
 * 
 * @param path
 * @param pluginId
 *            - plugin id to identify which plugin image should be loaded
 * @return image
 */
public static Image getImage(String path, String pluginId) {
	ImageRegistry imageRegistry = getImageRegistry();
	if (imageRegistry == null) {
		return null;
	}
	Image image = imageRegistry.get(path);
	if (image == null) {
		ImageDescriptor imageDesc = createImageDescriptor(path, pluginId);
		image = imageDesc.createImage();
		if (image == null) {
			image = PlatformUI.getWorkbench().getSharedImages().getImage(ISharedImages.IMG_OBJS_ERROR_TSK);
		}
		imageRegistry.put(path, image);
	}
	return image;
}
 
开发者ID:de-jcup,项目名称:eclipse-bash-editor,代码行数:27,代码来源:EclipseUtil.java

示例4: getImage

import org.eclipse.swt.graphics.Image; //导入依赖的package包/类
public Image getImage(Object objects) {
	if (objects == null || objects.equals(StructuredSelection.EMPTY)) {
		return null;
	}
	Object object = ((IStructuredSelection) objects).getFirstElement();
	if (object instanceof TableEditPart || object instanceof TableTreeEditPart) {
		return Activator.getImage(Activator.IMAGE_TABLE_16);
	} else if (object instanceof ColumnEditPart || object instanceof ColumnTreeEditPart) {
		return Activator.getImage(Activator.IMAGE_COLUMN_16);
	} else if (object instanceof SchemaEditPart || object instanceof SchemaTreeEditPart) {
		return Activator.getImage(Activator.IMAGE_SCHEMA_16);
	} else if (object instanceof ConnectionEditPart) {
		return Activator.getImage(Activator.IMAGE_CONNECTION);
	}
	return null;
}
 
开发者ID:bsteker,项目名称:bdf2,代码行数:17,代码来源:BaseModelLabelProvider.java

示例5: addStats

import org.eclipse.swt.graphics.Image; //导入依赖的package包/类
private void addStats() {

		for (String key : statsProject.keySet()) {
			if (key != project.getName()) {
				CLabel title = new CLabel(descriptifRight, SWT.BOLD);
				title.setText(key);
				title.setImage(new Image(display, getClass()
						.getResourceAsStream(
								"images/stats_"
										+ key.replaceAll(" ", "_")
												.toLowerCase() + "_16x16.png")));
				title.setBackground(new Color(display, 255, 255, 255));
				title.setMargins(10, 10, 0, 0);

				FontData[] fd = title.getFont().getFontData();
				fd[0].setStyle(SWT.BOLD);
				title.setFont(new Font(title.getFont().getDevice(), fd));

				CLabel subText = new CLabel(descriptifRight, SWT.NONE);
				subText.setText(statsProject.get(key)
						.replaceAll("<br/>", "\r\n").replaceAll("&nbsp;", " "));
				subText.setBackground(new Color(display, 255, 255, 255));
				subText.setMargins(30, 0, 0, 0);
			}
		}
	}
 
开发者ID:convertigo,项目名称:convertigo-eclipse,代码行数:27,代码来源:StatisticsDialog.java

示例6: createTopContent

import org.eclipse.swt.graphics.Image; //导入依赖的package包/类
protected void createTopContent(String title, InputStream imageName) {
    Composite top = new Composite(composite, SWT.NONE);

    top.setLayout(new GridLayout(2, false));
    top.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
    top.setBackground(display.getSystemColor(SWT.COLOR_WHITE));
    
    final Image image = new Image(top.getDisplay(), imageName);
    Image resized = resizeImage(image, 48, 48);
    Label labelImage = new Label(top, SWT.CENTER);
    labelImage.setImage(resized);
    
    Label label = new Label(top, SWT.NONE);
    label.setText(title);
    final Font newFont = new Font(display, fontName, getTitleFontSize(), SWT.NORMAL);
    label.setFont(newFont);
    label.setBackground(rowColorSelection);
    
    createLineContent();
    
    top.addDisposeListener(e -> {
        newFont.dispose();
        resized.dispose();
    });
}
 
开发者ID:gluonhq,项目名称:ide-plugins,代码行数:26,代码来源:PluginDialog.java

示例7: ImageRepository

import org.eclipse.swt.graphics.Image; //导入依赖的package包/类
/**
 * Private Constructor.
 */
private ImageRepository() {
	this.folderImage = new Image(Display.getDefault(),
	        ImageRepository.class.getResourceAsStream("/images/Fairytale_folder.png"));
	this.moonImage = new Image(Display.getDefault(),
			ImageRepository.class.getResourceAsStream("/images/Nuvola_apps_kmoon.png"));
	this.checkImage = new Image(Display.getDefault(),
	        ImageRepository.class.getResourceAsStream("/images/400px-P_yes_green.svg.png"));
	this.logfileImage = new Image(Display.getDefault(),
	        ImageRepository.class.getResourceAsStream("/images/Gartoon-Gedit-icon.png"));
	this.helpImage = new Image(Display.getDefault(),
	        ImageRepository.class.getResourceAsStream("/images/Nuvola_apps_filetypes.png"));
	this.infoImage = new Image(Display.getDefault(),
	        ImageRepository.class.getResourceAsStream("/images/Info_icon.png"));
	this.refreshImage = new Image(Display.getDefault(),
	        ImageRepository.class.getResourceAsStream("/images/Arrow_refresh.png"));
	this.editImage = new Image(Display.getDefault(),
	        ImageRepository.class.getResourceAsStream("/images/edit16.png"));
	this.pushImage = new Image(Display.getDefault(),
	        ImageRepository.class.getResourceAsStream("/images/push16.png"));
	this.popImage = new Image(Display.getDefault(),
	        ImageRepository.class.getResourceAsStream("/images/pop16.png"));
	this.emptyImage = new Image(Display.getDefault(),
	        ImageRepository.class.getResourceAsStream("/images/empty16.png"));
}
 
开发者ID:wwu-pi,项目名称:tap17-muggl-javaee,代码行数:28,代码来源:ImageRepository.java

示例8: getImage

import org.eclipse.swt.graphics.Image; //导入依赖的package包/类
/**
 * The <code>LabelProvider</code> implementation of this
 * <code>ILabelProvider</code> method returns <code>null</code>.
 * Subclasses may override.
 */
@Override
public Image getImage(Object ofield) {

	if (ofield == null) return null;

	FieldValue field  = (FieldValue)ofield;
	Object   element  = field.get();
	if (element instanceof Boolean) {
		if (ticked==null)   ticked   = Activator.getImageDescriptor("icons/ticked.png").createImage();
		if (unticked==null) unticked = Activator.getImageDescriptor("icons/unticked.gif").createImage();
		Boolean val = (Boolean)element;
		return val ? ticked : unticked;
	}
	return null;
}
 
开发者ID:eclipse,项目名称:scanning,代码行数:21,代码来源:ModelFieldLabelProvider.java

示例9: getIcon

import org.eclipse.swt.graphics.Image; //导入依赖的package包/类
protected Image getIcon(String fullPath) throws IOException {

		if (fullPath==null)      return defaultIcon;
		if ("".equals(fullPath)) return defaultIcon;

		try {
			if (iconMap.containsKey(fullPath)) return iconMap.get(fullPath);
			final String[] sa = fullPath.split("/");
			final Bundle bundle = Platform.getBundle(sa[0]);
			if (bundle==null) return defaultIcon;
			if (bundle!=null) {
				Image image = new Image(null, bundle.getResource(sa[1]+"/"+sa[2]).openStream());
				iconMap.put(fullPath, image);
			}
			return iconMap.get(fullPath);
		} catch (Exception ne) {
			logger.debug("Cannot get icon for "+fullPath, ne);
			return defaultIcon;
		}
	}
 
开发者ID:eclipse,项目名称:scanning,代码行数:21,代码来源:DetectorView.java

示例10: getImage

import org.eclipse.swt.graphics.Image; //导入依赖的package包/类
/**
 * Returns an {@link Image} stored in the file at the specified path.
 * 
 * @param path
 *            the path to the image file
 * @return the {@link Image} stored in the file at the specified path
 */
public static Image getImage(String path) {
	Image image = m_imageMap.get(path);
	if (image == null) {
		try {
			image = getImage(new FileInputStream(path));
			m_imageMap.put(path, image);
		} catch (Exception e) {
			image = getMissingImage();
			m_imageMap.put(path, image);
		}
	}
	return image;
}
 
开发者ID:fmcalcagno,项目名称:Sensors,代码行数:21,代码来源:SWTResourceManager.java

示例11: addDecorator

import org.eclipse.swt.graphics.Image; //导入依赖的package包/类
private ControlDecoration addDecorator(Control control, String message) {
	ControlDecoration txtDecorator = new ControlDecoration(control, SWT.LEFT);
	FieldDecoration fieldDecoration = FieldDecorationRegistry.getDefault().getFieldDecoration(
			FieldDecorationRegistry.DEC_ERROR);
	Image img = fieldDecoration.getImage();
	txtDecorator.setImage(img);
	txtDecorator.setDescriptionText(message);
	txtDecorator.setMarginWidth(3);
	return txtDecorator;
}
 
开发者ID:capitalone,项目名称:Hydrograph,代码行数:11,代码来源:ViewDataPreferencesDialog.java

示例12: getSmallImage

import org.eclipse.swt.graphics.Image; //导入依赖的package包/类
public Image getSmallImage(){
	if(this.customSmallImage==null){
		return this.defaultSmallImage;
	}else{
		return this.customSmallImage;
	}
}
 
开发者ID:bsteker,项目名称:bdf2,代码行数:8,代码来源:NodeImageConfig.java

示例13: loadGraphic

import org.eclipse.swt.graphics.Image; //导入依赖的package包/类
protected Graphic
loadGraphic(
	UISWTInstance	swt,
	String			name )
{
	Image	image = swt.loadImage( "com/biglybt/ui/images/" + name );

	Graphic graphic = swt.createGraphic(image );

	icon_list.add(image);

	return( graphic );
}
 
开发者ID:BiglySoftware,项目名称:BiglyBT,代码行数:14,代码来源:SubscriptionManagerUI.java

示例14: testIndirectImageCaching

import org.eclipse.swt.graphics.Image; //导入依赖的package包/类
/**
 * Checks the indirect {@link Image image} caching.
 */
@Test
public void testIndirectImageCaching() {
	final ImageDescriptor desc1 = ImageRef.LIB_PATH.asImageDescriptor().orNull();
	final ImageDescriptor desc2 = ImageRef.LIB_PATH.asImageDescriptor().orNull();
	final Image img1 = desc1.createImage();
	final Image img2 = desc2.createImage();
	assertTrue("Expected different reference of images.", img1 != img2);
}
 
开发者ID:eclipse,项目名称:n4js,代码行数:12,代码来源:GHOLD_170_ImageCaching_PluginUITest.java

示例15: decorateImage

import org.eclipse.swt.graphics.Image; //导入依赖的package包/类
@Override
public Image decorateImage(Image image, Object element) {
	if (image!=null) {
		if (element instanceof IProject) {
			IProject project = (IProject) element;
			boolean b = GW4ENature.hasGW4ENature(project);
			if (b) {
				DecorationOverlayIcon icon = new DecorationOverlayIcon(image, GW_DESCRIPTOR, IDecoration.TOP_LEFT);
				Image ret = (Image)resourceManager.get(icon);
				return ret;
			}
		}
	}
	return image;
}
 
开发者ID:gw4e,项目名称:gw4e.project,代码行数:16,代码来源:ProjectLabelDecorator.java


注:本文中的org.eclipse.swt.graphics.Image类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。