Does anybody know where are and how can I obtain internal images which are used by SWT/JFace, like WARNING, ERROR or INFORMATION icons and others...? Where are they situated and how to get them into my code ?
Some parts of JFace uses images from JFaceResources
rather than SWT
. You find these as
Image i = JFaceResources.getImage(...);
Unfortunately, everybody can install new images into the resource manager, so there are no way to predict the names of images. Some general images are installed in JFaceResources.initializeDefaultImages()
.
(If you have images, font or colors you use multiple times across your application, then look into JFaceResources
.)
Also - if you are using Eclipse RCP - you can find a number of images using
Image i = PlatformUI.getWorkbench().getSharedImages().getImage(ISharedImages...);
You can find additional constants in org.eclipse.ui.ide.IDE.SharedImages
and org.eclipse.ui.internal.ide.IDEInternalWorkbenchImages
(for IDEs).
You can use the getSystemImage()
method of Display
to get those images. For example:
Display d = Display.getCurrent();
Image img = d.getSystemImage(SWT.ICON_WARNING);
Hope that helps
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.