复制代码代码如下:
import org.eclipse.swt.graphics.gc;
import org.eclipse.swt.graphics.image;
import org.eclipse.swt.graphics.rectangle;
import org.eclipse.swt.widget.display;
import org.eclipse.swt.widget.shell;
classe publique ImageSheLelloworld {
public static void main (String [] args) {
Affichage affichage = display.getDefault ();
Shell shell = new shell ();
Image image = nouvelle image (affichage, "c: //c240b2dcc132c9c6.jpg");
shell.setText ("ImageReader");
shell.setimage (image);
Rectangle bounds = image.getBounds ();
shell.setSize (bounds.width + 15, bounds.height +15);
shell.open ();
GC GC = nouveau GC (Shell);
GC.DrawImage (image, 5,5);
shell.layout ();
while (! shell.isdisposed ()) {
if (! display.readanddispatch ()) {
affichage.Sleep ();
}
}
affiche.dispose ();
}
}