复制代码代码如下:
org.eclipse.swt.graphics.gcをインポートします。
Import org.eclipse.swt.graphics.image;
org.eclipse.swt.graphics.rectangleをインポートします。
org.eclipse.swt.widgets.displayをインポートします。
org.eclipse.swt.widgets.shellをインポートします。
パブリッククラスの画像shelloworld {
public static void main(string [] args){
表示display = display.getDefault();
シェルシェル= new Shell();
画像画像= new Image(display、 "c://c240b2dcc132c9c6.jpg");
shell.settext( "imagreader");
shell.setImage(画像);
長方形の境界= image.getBounds();
shell.setsize(bounds.width + 15、bounds.height +15);
shell.open();
GC GC = new GC(Shell);
gc.drawimage(画像、5,5);
shell.layout();
while(!shell.isdisposed()){
if(!display.readanddispatch()){
display.sleep();
}
}
display.dispose();
}
}