我的尝试如下,没有提出任何结果:
public static void main(String[] args) {
Display display = new Display();
Shell shell = new Shell(display);
Image image = new Image(display,
"D:/topic.png");
GC gc = new GC(image);
gc.setForeground(display.getSystemColor(SWT.COLOR_WHITE));
gc.drawText("I've been drawn on",0,0,true);
gc.dispose();
shell.pack();
shell.open();
while (!shell.isDisposed()) {
if (!display.readAndDispatch()) {
display.sleep();
}
}
display.dispose();
// TODO Auto-generated method stub
}
Run Code Online (Sandbox Code Playgroud)
有关示例,请参阅SWT-Snippets.这个使用图像标签
Shell shell = new Shell (display);
Label label = new Label (shell, SWT.BORDER);
label.setImage (image);
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
21103 次 |
| 最近记录: |