复制代码代码如下::
import org.eclipse.swt.graphics.gc;
import org.eclipse.swt.graphics.image;
import org.eclipse.swt.graphics.rectangle;
import org.eclipse.swt.widgets.display;
import org.eclipse.swt.widgets.shell;
öffentliche Klasse imageshelloworld {
public static void main (String [] args) {
Display display = display.getDefault ();
Shell Shell = New Shell ();
Image Image = New Image (Anzeige, "c: //c240b2dcc132c9c6.jpg");
Shell.SetText ("Imagereader");
Shell.SetImage (Bild);
Rechteck bodens = image.getBounds ();
Shell.SetSize (bounds.width + 15, bounds.height +15);
Shell.open ();
Gc gc = neu gc (Shell);
gc.drawimage (Bild, 5,5);
Shell.Layout ();
while (! Shell.isDisposed ()) {
if (! display.readandDispatch ()) {
display.sleep ();
}
}
display.dispose ();
}
}