我正在尝试绘制一个swt
Image但没有出现:
Display display = new Display();
Shell shell = new Shell(display);
shell.open();
Image image = new Image(display, "C:/sample_image.png");
Rectangle bounds = image.getBounds();
GC gc = new GC(image);
gc.drawImage(image, 100, 100);
// gc.drawLine(0, 0, bounds.width, bounds.height);
// gc.drawLine(0, bounds.height, bounds.width, 0);
// gc.dispose();
// image.dispose();
while (!shell.isDisposed()) {
if (!display.readAndDispatch())
display.sleep();
}
display.dispose();
我已经测试过图像存在并且有内容 – 任何想法?