Java tutorial
import org.eclipse.jface.resource.ImageRegistry; import org.eclipse.swt.SWT; import org.eclipse.swt.graphics.Image; import org.eclipse.swt.layout.GridLayout; import org.eclipse.swt.widgets.Button; import org.eclipse.swt.widgets.Display; import org.eclipse.swt.widgets.Shell; public class ImageRegistryUsing { public static void main(String[] args) { Display display = new Display(); Shell shell = new Shell(); shell.setLayout(new GridLayout(1, false)); ImageRegistry ir = new ImageRegistry(); ir.put("image1", new Image(display, "yourFile.gif")); Button executeButton = new Button(shell, SWT.PUSH); executeButton.setText("Execute"); executeButton.setImage(ir.get("image1")); shell.open(); while (!shell.isDisposed()) { if (!display.readAndDispatch()) { display.sleep(); } } display.dispose(); } }