复制代码代码如下:
นำเข้า org.eclipse.swt.graphics.gc;
นำเข้า org.eclipse.swt.graphics.image;
นำเข้า org.eclipse.swt.graphics.rectangle;
นำเข้า org.eclipse.swt.widgets.display;
นำเข้า org.eclipse.swt.widgets.shell;
ชั้นเรียนสาธารณะ imageshelloworld {
โมฆะคงที่สาธารณะหลัก (สตริง [] args) {
display display = display.getDefault ();
เชลล์เชลล์ = เชลล์ใหม่ ();
Image image = ภาพใหม่ (แสดง, "c: //c240b2dcc132c9c6.jpg");
Shell.Settext ("ImageReader");
Shell.setImage (ภาพ);
ขอบเขตสี่เหลี่ยมผืนผ้า = image.getBounds ();
shell.setsize (bounds.width + 15, bounds.height +15);
Shell.open ();
GC GC = ใหม่ GC (เชลล์);
GC.Drawimage (ภาพ, 5,5);
Shell.layout ();
ในขณะที่ (! shell.isdisposed ()) {
if (! display.readandDispatch ()) {
display.sleep ();
-
-
display.dispose ();
-
-