复制代码代码如下:
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;
clase pública Imageshelloworld {
public static void main (string [] args) {
Display Display = Display.getDefault ();
Shell shell = new Shell ();
Imagen imagen = nueva imagen (pantalla, "c: //c240b2dcc132c9c6.jpg");
shell.settext ("ImageReader");
shell.setImage (imagen);
Rectangle Bounds = Image.getBounds ();
shell.setsize (Bounds.Width + 15, Bounds.Height +15);
shell.open ();
GC GC = nuevo GC (shell);
gc.drawimage (imagen, 5,5);
shell.layout ();
while (! shell.isdisposse ()) {
if (! display.readanddispatch ()) {
display.sleep ();
}
}
display.dispose ();
}
}