Image.win32_new (Display.getDefault(), SWT.ICON, 65545)
Image org.eclipse.swt.graphics.Image.win32_new(Device device, int type, int handle)
Invokes platform specific functionality to allocate a new image.
IMPORTANT: This method is not part of the public API for Image
. It is marked public only so that it can be shared within the packages provided by SWT. It is not available on all platforms, and should never be called from application code.
-
参数:
- device the device on which to allocate the color
-
type the type of the image (
SWT.BITMAP
orSWT.ICON
) - handle the OS handle for the image 返回:
- a new image object containing the specified device, type and handle
Display.getDefault().getSystemImage(SWT.ICON_WORKING)
Image org.eclipse.swt.widgets.Display.getSystemImage(int id)
Returns the matching standard platform image for the given constant, which should be one of the icon constants specified in class SWT
. This image should not be free‘d because it was allocated by the system, not the application. A value of null
will be returned either if the supplied constant is not an swt icon constant or if the platform does not define an image that corresponds to the constant.
-
参数:
- id the swt icon constant 返回:
-
the corresponding image or
null
抛出:
-
SWTException
- ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
- ERROR_DEVICE_DISPOSED - if the receiver has been disposed
另请参阅:
- SWT.ICON_ERROR
- SWT.ICON_INFORMATION
- SWT.ICON_QUESTION
- SWT.ICON_WARNING
- SWT.ICON_WORKING @since
- 3.0
AbstractUIPlugin.imageDescriptorFromPlugin(Application.ID,"icons/types.gif")
ImageDescriptor org.eclipse.ui.plugin.AbstractUIPlugin.imageDescriptorFromPlugin(String pluginId, String imageFilePath)
Creates and returns a new image descriptor for an image file located within the specified plug-in.
This is a convenience method that simply locates the image file in within the plug-in (no image registries are involved). The path is relative to the root of the plug-in, and takes into account files coming from plug-in fragments. The path may include $arg$ elements. However, the path must not have a leading "." or path separator. Clients should use a path like "icons/mysample.gif" rather than "./icons/mysample.gif" or "/icons/mysample.gif".
-
参数:
-
pluginId the id of the plug-in containing the image file;
null
is returned if the plug-in does not exist - imageFilePath the relative path of the image file, relative to the root of the plug-in; the path must be legal 返回:
-
an image descriptor, or
null
if no image could be found
4。
static final Image
UNCHECKED = createImage("images/checkboxenabledoff.gif"), //$NON-NLS-1$
CHECKED = createImage("images/checkboxenabledon.gif"); //$NON-NLS-1$
private static Image createImage(String name) {
InputStream stream = CheckBox.class.getResourceAsStream(name);
Image image = new Image(null, stream);
try {
stream.close();
} catch (IOException ioe) {
}
return image;
}
5。
ImageRegistry reg = JFaceResources.getImageRegistry();
reg.put(CELL_EDITOR_IMG_DOTS_BUTTON, ImageDescriptor.createFromFile(
DialogCellEditor.class, "images/dots_button.gif"));