复制代码代码如下:
importar org.eclipse.swt.graphics.gc;
importar org.eclipse.swt.graphics.image;
importar org.eclipse.swt.graphics.rectangle;
importar org.eclipse.swt.widgets.display;
importar org.eclipse.swt.widgets.shell;
classe pública ImagesHelloworld {
public static void main (string [] args) {
Display display = display.getDefault ();
Shell shell = new shell ();
Imagem de imagem = nova imagem (exibição, "c: //c240b2dcc132c9c6.jpg");
shell.settext ("imageReader");
shell.setImage (imagem);
Limites de retângulo = image.getBounds ();
Shell.SetSize (Bounds.Width + 15, Bounds.Eight +15);
shell.open ();
Gc gc = novo gc (shell);
gc.drawimage (imagem, 5,5);
shell.layout ();
while (! shell.isdisposed ()) {
if (! Display.readAndDispatch ()) {
display.sleep ();
}
}
display.dispose ();
}
}