复制代码代码如下:
impor org.eclipse.swt.graphics.gc;
impor org.eclipse.swt.graphics.image;
impor org.eclipse.swt.graphics.rectangle;
impor org.eclipse.swt.widgets.display;
impor org.eclipse.swt.widgets.shell;
kelas publik imageshellorld {
public static void main (string [] args) {
Display display = display.getDefault ();
Shell shell = shell baru ();
Gambar gambar = gambar baru (tampilan, "c: //c240b2dcc132c9c6.jpg");
shell.setText ("imagereader");
shell.setImage (gambar);
Batas persegi panjang = image.getBounds ();
shell.setsize (bounds.width + 15, batas.
shell.open ();
GC GC = GC baru (shell);
gc.drawimage (gambar, 5,5);
shell.layout ();
while (! shell.isdisposed ()) {
if (! display.readanddispatch ()) {
display.sleep ();
}
}
display.dispose ();
}
}