本文整理匯總了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;
}
示例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);
}
示例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;
}
示例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;
}
示例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(" ", " "));
subText.setBackground(new Color(display, 255, 255, 255));
subText.setMargins(30, 0, 0, 0);
}
}
}
示例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();
});
}
示例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"));
}
示例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;
}
示例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;
}
}
示例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;
}
示例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;
}
示例12: getSmallImage
import org.eclipse.swt.graphics.Image; //導入依賴的package包/類
public Image getSmallImage(){
if(this.customSmallImage==null){
return this.defaultSmallImage;
}else{
return this.customSmallImage;
}
}
示例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 );
}
示例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);
}
示例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;
}